On Apr 4, 1:56   쮮 
> Junkone wrote:
> > how to convert the string in this format ="Monday April, 3, 2006 10:34M" 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")3D> #<DateTime: 1766756837/720,0,2299161>
> irb(main):003:0> date.strftime
> => "2006-04-03T10:34:00+00:00"
>
> -Justin- Hide quoted text -
>
> - Show quoted text -

thanks. it works