Subject: | Date_DayOfWeek broken |
#!/usr/bin/perl
use Date::Manip;
$version = DateManipVersion;
print "Version $version\n";
# Notice how the Date_DayOfWeek behaves.
sub tcase {
my ($smon,$sdom,$syr,@xs) = @_;
my $ndow = Date_DayOfWeek($sdom,$smon,$syr) - 1;
my $sdow = ( "Mon","Tue","Wed","Thu","Fri","Sat","Sun" )[$ndow];
my $elaps = Date_SecsSince1970($smon,$sdom,$syr,0,0,0);
my $odo = int($elaps/86400-4) % 7;
my $csdow = ( "Mon","Tue","Wed","Thu","Fri","Sat","Sun" )[$odo];
print "Y-M-D: $syr-$smon-$sdom: $ndow($sdow), $odo($csdow)\n";
}
foreach $d (1..7) {&tcase(1,$d,2007);}
---------------------------------------------------------------------
-----------result of run:
bill@phex:~/biz/bill/calendar> perl tc
Version 5.44
Y-M-D: 2007-1-1: 0(Mon), 0(Mon)
Y-M-D: 2007-1-2: 3(Thu), 1(Tue)
Y-M-D: 2007-1-3: 3(Thu), 2(Wed)
Y-M-D: 2007-1-4: 6(Sun), 3(Thu)
Y-M-D: 2007-1-5: 1(Tue), 4(Fri)
Y-M-D: 2007-1-6: 4(Fri), 5(Sat)
Y-M-D: 2007-1-7: 6(Sun), 6(Sun)