Posts Tagged ‘parse’

Date.parse() is not your friend.

Sunday, February 7th, 2010

I’ve started looking at Ruby 1.9 with multiruby, and one of the first things that I found in testing is that Date.parse assumes European dates (dd/mm/yyyy format) in v1.9. The solution is to use strptime() instead so you can specify a format.

Date.strptime("12/31/2009", "%m/%d/%Y")