Reputation: 3232
Is there an easy inbuilt method in ruby which converts "20130313T113000Z" to a ruby Date format?
Upvotes: 0
Views: 76
Reputation: 11951
Yes, DateTime::parse:
DateTime.parse("20130313T113000Z")
=> #<DateTime: 2013-03-13T11:30:00+00:00 ((2456365j,41400s,0n),+0s,2299161j)>
Or use Date.parse
if you don't need the hours, minutes and seconds.
Upvotes: 3