help in changing string format

J

Junkone

I need some help in converting this date time format to the one
time.parse will accept.

irb(main):039:0> time="31/12/2007 5:00:00 PM"
=> "31/12/2007 5:00:00 PM"
irb(main):040:0> Time.parse(time)
ArgumentError: argument out of range
from e:/ruby/lib/ruby/1.8/time.rb:184:in `local'
from e:/ruby/lib/ruby/1.8/time.rb:184:in `make_time'
from e:/ruby/lib/ruby/1.8/time.rb:243:in `parse'
from (irb):40
from ¢¾:0

apprecaite ur help.

seede
 
S

Sebastian Hungerecker

Junkone said:
I need some help in converting this date time format to the one
time.parse will accept.

irb(main):039:0> time="31/12/2007 5:00:00 PM"

Replace the slashes with dashes.

HTH,
Sebastian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top