Junkone wrote:
> how to convert the string in this format ="Monday April, 3, 2006 10:34
> AM" into a datetime object. When i use Date.parse, i lose the time on
> it. when i use ParseDate.parsedate(d)
> i get only a array. any help is appreciated.
>
>
> E:\TradingTools\CODE>irb
> irb(main):001:0> d="Monday April, 3, 2006 10:34 AM"
> => "Monday April, 3, 2006 10:34 AM"
> irb(main):002:0> Date.parse(d)
> => #<Date: 4907657/2,0,2299161>
>
> irb(main):004:0> pd=ParseDate.parsedate(d)
> => [2006, 4, 3, 10, 34, nil, nil, 1]
>
>   
If you want a DateTime object, then you need to use that, not Date.

irb(main):001:0> require 'date'
=> true
irb(main):002:0> date = DateTime.parse("Monday April, 3, 2006 10:34 AM")
=> #<DateTime: 1766756837/720,0,2299161>
irb(main):003:0> date.strftime
=> "2006-04-03T10:34:00+00:00"


-Justin