When is 2009-06-02 not 2nd June?

The obvious answer is when it’s 6th February (YYYYDDMM format) but there’s another much darker answer that I discovered today.

http://groups.google.com/group/google-visualization-api/browse_thread/thread/1c6ddcfd98dc9803/9a1ab79782bc5118?hl=en&lnk=gst&q=annotated+timeline#9a1ab79782bc5118

After having a look at the Google Visualization API, it turns out that JavaScript treats months as zero based rather than one based, it turns out that new Date(2009, 06, 02) is actually the 2nd of May. It makes sense if you then have an array of strings and want to easily convert from one to the other, but it’s useful information to know as it’s not the most obvious thing in the world!

Published 02 June 2009 17:00 by Mat Steeples

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required)