Because in the USA they get the dates backwards, it's important not to simply use Date.parse() because you'll find 9/11/2001 can be 11 September 2001 in the USA and 9 November 2001 in the rest of the world. To be completely unambiguous use Date::strptime(your_date_string,"%d-%m-%Y") to correctly parse a date string of format dd-mm-yyyy.
Also I always make sure I set my base timezone to :utc if my website is going to be handling any dates, and use Javascript on the client side to display local times.
Because in the USA they get the dates backwards, it's important not to simply use
Date.parse()
because you'll find 9/11/2001 can be 11 September 2001 in the USA and 9 November 2001 in the rest of the world. To be completely unambiguous useDate::strptime(your_date_string,"%d-%m-%Y")
to correctly parse a date string of formatdd-mm-yyyy
.Try this to be sure:
For other
strptime
formats see http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.htmlAlso I always make sure I set my base timezone to
:utc
if my website is going to be handling any dates, and useJavascript
on the client side to display local times.