Topic: parse this string to a date

Hi, I need to turn this into a date:

"Thu Jun 03 02:34:19 +0000 2010"

I tried:
DateTime.strptime(first_rt.created_at,'%a %b %d %H:%m:%S %%+0000 %Y')

gave exception, not sure how to handle the +0000

thanks
Joel

Last edited by jnylund (2010-06-10 20:44:40)

Re: parse this string to a date

It would help a bit if the date/format.rb module had even a single comment in it... roll

DateTime.strptime(date_string,'%a %b %d %H:%M:%S %Z %Y')

Note the changes: %m (months) becomes %M (minutes) and %%+0000 becomes %Z (zone).

Re: parse this string to a date

thanks that worked!