in reply to Monthly hours report
I don't know how tolerant of timezone and DST issues this is so if you use it, manually check the math or ask the DateTime mailing list for advice (I love the kit but I'm not a power user).
use strict; use warnings; use DateTime; my $in = DateTime->new( year => 2009, month => 06, day => 22, hour => 8, minute => 30, second => 0, ); my $out = DateTime->new( year => 2009, month => 06, day => 22, hour => 17, minute => 15, second => 0, ); my $duration = $out - $in; printf("%.2f hour(s)\n", $duration->days * 24 + $duration->hours + $duration->minutes / 60 ); __END__ 8.75 hour(s)
|
|---|