# Help in changing string format

**URL:** <https://www.ruby-forum.com/t/help-in-changing-string-format/124717>\
**Category:** Ruby\
**Created:** [January 1, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/help-in-changing-string-format/124717 "2008-01-01T18:35:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [January 1, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/help-in-changing-string-format/124717/1 "2008-01-01T18:35:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [January 1, 2008, 6:46pm UTC](https://www.ruby-forum.com/t/help-in-changing-string-format/124717/2 "2008-01-01T18:46:06Z")

</div>

Junkone wrote:

> 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
