Stoopidboi Stoopidboi wrote:
> I'm trying to display a date/time in 12-hour format. According to the
> Time.strftime API (http://ruby-doc.org/core/classes/Time.html#M000297)
> the 12-hour hour range is supposed to be [1..12]. Why am I getting
> "00:13:14 PM" for the time portion when I execute the following line?
>
> How should I write so that I'll get "12:13:14 PM" instead?
>
> Time.local(2007, 'nov', 27, 12, 13, 14).strftime("%Y-%m-%d %I:%M:%S %p")
>   
I copy-pasted this into IRB and it worked just fine:

irb(main):001:0> Time.local(2007, 'nov', 27, 12, 13, 
14).strftime("%Y-%m-%d %I:%M:%S %p")
=> "2007-11-27 12:13:14 PM"

ruby 1.8.6 (2007-09-23 patchlevel 110) [i686-linux]

-Justin