I have this DateTime:
=> Fri, 03 Feb 2012 11:52:42 -0500
How can I remove the zone(-0500) in ruby? I just want something like this:
Time always has a zone (it has no meaning without one). You can choose to ignore it when printing by using DateTime#strftime:
now = DateTime.now
puts now
#=> 2012-02-03T10:01:24-07:00
puts now.strftime('%a, %d %b %Y %H:%M:%S')
#=> Fri, 03 Feb 2012 10:01:24
See Time#strftime for the arcane codes used to construct a particular format.
Alternatively, you may wish to convert your DateTime to UTC for a more general representation.