From: Jan Friedrich Date: 2010-08-24T03:29:15+09:00 Subject: [ruby-core:31833] [Bug #3737] DateTime#to_time doesn't preserve zone Bug #3737: DateTime#to_time doesn't preserve zone http://redmine.ruby-lang.org/issues/show/3737 Author: Jan Friedrich Status: Open, Priority: Normal ruby -v: ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0] Why does DateTime#to_time doesn't preserve the time zone but convert the timestamp to local time zone? d = DateTime.new(2010, 8, 23, 20, 14, 10, '+08:00') puts d # => 2010-08-23T20:14:10+08:00 t = d.to_time puts t # => 2010-08-23 14:14:10 +0200 I would expect that t is in time zone +08:00 not +02:00. If I want the time in local time zone I can call t.localtime, but I have no chance to preserve the zone information. If this behavior is intentional the the DateTime#to_time method is useless for most of my use cases. My actual workaround is following code: t = Time.new(d.year, d.month, d.day, d.hour, d.minute, d.second, d.zone) puts t #= => 2010-08-23 20:14:10 +0800 Best regards Jan ---------------------------------------- http://redmine.ruby-lang.org