If I type
DateString[{2011, 2, 29, 0, 0, 0}, {"DayName"}]
It gives "Tuesday"
.
And also,
DateString[{2011, 2, 29, 0, 0, 0}, {"DayName"}]
DateString[{2011, 3, 1, 0, 0, 0}, {"DayName"}]
If I type
DateString[{2011, 2, 29, 0, 0, 0}, {"DayName"}]
It gives "Tuesday"
.
And also,
DateString[{2011, 2, 29, 0, 0, 0}, {"DayName"}]
DateString[{2011, 3, 1, 0, 0, 0}, {"DayName"}]
This looks to me like correct behaviour. The documentation for DateString
says: "Values of m, d, h, m, s outside their normal ranges are appropriately reduced." which is just what's happened: there isn't really a 29th of February this year, but if there were it would be the same day that's actually the 1st of March, which is indeed a Tuesday.
Needs["Calendar`"];
myDay[x_List] := DateString[x, {"DayName"}] /; DateQ[x]
myDay[{2000, 1, 1}]
->"Saturday"
myDay[{2000, 13, 13}]
->myDay[{2000, 13, 13}]
Of course you may throw a message (or Abort[], or whatever) if you want to :
Needs["Calendar`"];
Clear@myDay;
myDay[x_] /; If[DateQ[x], True, Message[myDay::nodate, x]; False] :=
DateString[x, {"DayName"}]
myDay::nodate = "The argument `1` is not a valid date.";