irb(main):010:0> time=arr[1][1]
=> "11/09/2008 4:32:58 AM"
how can i convert the time to 24 hours like from 4:32:58 AM to
16:32:58
irb(main):010:0> time=arr[1][1]
=> "11/09/2008 4:32:58 AM"
how can i convert the time to 24 hours like from 4:32:58 AM to
16:32:58
Junkone wrote:
irb(main):010:0> time=arr[1][1]
=> "11/09/2008 4:32:58 AM"how can i convert the time to 24 hours like from 4:32:58 AM to
16:32:58
require 'time'
Time.parse("9:03 pm").strftime("%H:%M:%S")
=> "21:03:00"
Time.parse("9:03 pm").strftime("%I:%M:%S %p")
=> "09:03:00 PM"
Time.parse("21:03").strftime("%H:%M:%S")
=> "21:03:00"
Time.parse("21:03").strftime("%I:%M:%S %p")
=> "09:03:00 PM"
For details:
ri Time#strftime
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407