DateList not using current year when a year is not specified

10

1

Bug introduced in 8.0 and fixed in 9.0


According to the documentation when using DateList but not giving it a year it should use the current year. It is not doing that for me. Instead it uses 1900. Evaluating the example in the documentation:

DateList[{"2/15", {"Month", "Day"}}]

results in

{1900, 2, 15, 0, 0, 0.}

when I would expect

{2012, 2, 15, 0, 0, 0.}

Am I reading the documentation wrong, or do I have some setting set wrong somewhere, or is this a bug if some kind?

Mr Alpha

Posted 2012-07-09T22:21:41.253

Reputation: 3 046

I get the same 1900 result (Mma 8.0.4, Win7) and yes, the documentation does explicitly say that. Interestingly the documentation example of DateList[{"2/15", {"Month", "Day"}}] has an integer zero in the seconds position, instead of 0.. Very odd! I think you might have found a bug. – Verbeia – 2012-07-09T22:41:19.567

I guess the problem is only with the DateList[{string, {e1, e2, ...}] input. Others use the current year. For example, DateList["23 Nov"] or even DateList["23/11"], although the latter gives a warning that it is ambiguous – rm -rf – 2012-07-09T23:11:23.343

On version 7 under Windows 7 for entry DateList[{"2/15", {"Month", "Day"}}] I get output {2012, 2, 15, 0, 0, 0}. – Mr.Wizard – 2012-07-09T23:25:26.773

I get {2012, 2, 15, 0, 0, 0} on "7.0 for Linux x86 (32-bit) (November 11, 2008)" – None – 2012-07-12T13:56:01.480

Answers

2

This seems to be a bug in V8, it works in V7 and now in V9.

Joel Klein

Posted 2012-07-09T22:21:41.253

Reputation: 4 935