How can I remove the zone from a DateTime value?

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)