From: Wes Gamble Date: 2008-02-22T16:28:00+09:00 Subject: DateTime.new vs. DateTime.now This may be a well known thing but it surprised me. Apparently, the time zone of DateTime.now is GMT, but the time zone of DateTime.new(y, m, d, h, m, s) is local. Below, I store DateTime.now in x. Then I construct a new DateTime object using the various components of x. You might expect that x - y would be 0 or very close to it, but in fact it is very close to the offset of my time zone (US Central) from GMT, which is .25 day (or 360 min if you multiply .25 day * (1440 min/day)). This implies that DateTime.now is in GMT and DateTime.new(y, m, d, h, m, s) is in local time. Can anyone point me to definitive documentation about this behavior? Thanks, Wes >> x = DateTime.now => # >> y = DateTime.new(x.year, x.month, x.day, x.hour, x.min, x.sec, x.sec_fraction ) => # >> x - y => Rational(10800293, 43200000) >> (x - y).to_f => 0.250006782407407 >> (x - y).to_f * 1440 => 360.009766666667 >> y - y => Rational(0, 1) P. S. Another unusual thing is this: >> (DateTime.now - DateTime.new).to_f => 2454519.30391494 What's that??? -- Posted via http://www.ruby-forum.com/.