From: Glenn Jackman Date: 2009-09-01T06:20:06+09:00 Subject: Re: Time Format Conversions At 2009-08-31 02:09PM, "s.ross" wrote: > On Aug 31, 2009, at 10:27 AM, Alpha Blue wrote: > > So, I'm trying to find out the best practice for converting a time > > format from the following: > > > > "3:00 PM" > > "10:00 PM" > > "1:00 AM" > > > > TO: > > > > "15:00:00" > > "22:00:00" > > "01:00:00" > > $ gem install chronic > $ irb > > require 'chronic' > > Chronic.parse("3:00 PM").strftime('%H:%M:%S') > => "15:00:00" Don't need a gem, the 'time' package from the standard library will do: require 'time' new = Time.parse(old).strftime("%T") -- Glenn Jackman Write a wise saying and your name will live forever. -- Anonymous