This journal is my first foray into a technical annotation of my perl life...
sub days_between($$) {
(str2time($_[1])-str2time($_[0])) / SECONDS_IN_A_DAY;
}
Seems obvious enough. Then some results were non-integer. Boiled down to,
$ perl -MDate::Parse -le 'print ((str2time($ARGV[1])-str2time($ARGV[0]))/86400)' 2004-10-31 2004-11-01
1.04166666666667
$
Why? Ah, Daylight savings!
25 hours in a day 0 Comments More | Login | Reply /