On Thu, Aug 15, 2013 at 5:15 PM, Phil <p...@edgedesign.us> wrote:

>
> I'm porting an old rails app to Rails 4 and got stumped tonight on time
> conversions.
>
> This worked:
>
> Loading development environment (Rails 2.3.18)
> > > Time.now.to_s
> => "08/14/2013 07:09PM"
>
> Now it doesn't on Rails 4.0:
>
> Loading development environment (Rails 4.0.0)
>
> irb(main):002:0> Time.now.to_s
> => "08/15/2013 12:19AM"
>

1.9.3 (main):0 > Date.parse("08/20/2013").to_s
ArgumentError: invalid date
from (pry):22:in `parse'
1.9.3 (main):0 > Date.parse("20/08/2013").to_s
=> "2013-08-20"
1.9.3 (main):0 >

In the source for e.g. ruby-1.9.3-p448 see ./doc/NEWS-1.9.1:

o Time.parse and Date.parse interprets slashed numerical datesĀ·
     as "dd/mm/yyyy".

>
>
HTH!
-- 
Hassan Schroeder ------------------------ hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAQEDNjSQ6KtaYyn-SrxzAWecv2GZj3y%2BGC3T8ZO1_vrw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to