Skip to main content
3 of 4
added 1 characters in body
Peter Taylor
  • 43.1k
  • 4
  • 70
  • 169

Perl, no date library: 160

sub f{($y,$m)=split/-/,@_[0],2;$y++if($m>'02-28');$y=(($y+3)>>2)%100;@r=(Sun,Mon,Tues,Wednes,Thurs,Fri,Satur);@r[(2+5*$y+4*($y/25&3)+2*(($y-1)/25&3))%7]."day";}

The real benefit of these date libraries is pushing off the length of the names of the days to someone else.

On the other hand, I think this is the only solution so far which works regardless of locale.

Peter Taylor
  • 43.1k
  • 4
  • 70
  • 169