# DOW = ([23m/9] + d + 4 + z + [z/4]  [z/100] + [z/400]  2 (if m>=3
+)) mod 7
#
# y is the year.
# m is the month.
# d is the day.
# z = y  1 (if m < 3)
# = y (if m >= 3)
# A mod B means take the reminder of A / B.
#
# The source: Journal on Recreational Mathematics, Vol. 22(4), pages
+280282, 1990.
# The authors: Michael Keith and Tom Craver.
#
# The formula can be implemented by the following C function:
#
# int dayofweek(int y,m,d)
# {
# return((23*m/9+d+4+(m<3?y:y2)+y/4y/100+y/400)%7);
# }
sub dow {
my ($y, $m, $d) = @_;
$y if $m < 3;
$d += 11 if $y < 1752  $y == 1752 && $m < 9;
if ($y >= 1752) {
return (int(23*$m/9)+$d+4+($m<3?$y+1:$y2)+int($y/4)int($y/100)+i
+nt($y/400))%7;
} else {
return (int(23*$m/9)+$d+5+($m<3?$y+1:$y2)+int($y/4))%7;
}
}
