From: Brian Candler Date: 2010-09-21T18:16:06+09:00 Subject: Re: Date#parse assume a EU format - can it assume a US format? Josh Sharpe wrote: > Before you jump to an answer here, please don't suggest that I use > _strptime. Going that route forces my users to give me the date and/or > time in the format that I specify. Which is really not optimal. > > So the problem is that Date#parse assumes that the format is > day/month/year. It is U.S. middle-endian format in 1.8.7. But try this monkey-patch for 1.9.2: require 'date' def Date._parse_sla(str, e) # :nodoc: if str.sub!(%r|('?-?\d+)/\s*('?\d+)(?:\D\s*('?-?\d+))?|, ' ') # ' s3e(e, $2, $1, $3) true end end >> Date.parse("10/04/2010") => # -- Posted via http://www.ruby-forum.com/.