How to getDate

irb(main):023:0> start_date = “Mon
Nov 20 00:00:00 UTC+0530 2006”

=> “Mon Nov 20 00:00:00 UTC+0530
2006”

irb(main):025:0> d= Date.strptime(start_date,
‘%a %b %d %H:%M:%S %Z %Y’)

=> #<Date: 4908119/2,0,2299161>

irb(main):026:0> d.strftime

=> “2006-11-20”

Regards,

Dave

Sure. You can get it back with
d.strftime('%a %b %d %H:%M:%S %Z %Y')

require 'date'

t = 'Mon Nov 20 00:00:00 UTC+0530 2006'
d= Date.strptime(t, '%a %b %d %H:%M:%S %Z %Y')
date = d.to_s
year, month, day = date.split(/-/)
month = month.sub(/^0/,'')
puts day + "/" + month + "/" + year

puts d.strftime('%a %b %d %H:%M:%S %Z %Y')

Something screwy with the time zone name though...

Dave
Dave wrote: