Issue #11673 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Assigned to Closed This is expected behavior. Without a timezone offset specified, `Time` assumes local time and `DateTime` assumes UTC. ---------------------------------------- Bug #11673: Inconsistent timezone behaviour (Time.parse and DateTime.parse) https://bugs.ruby-lang.org/issues/11673#change-79571 * Author: Arnvald (Grzegorz Witek) * Status: Closed * Priority: Normal * Assignee: tadf (tadayoshi funaba) * Target version: * ruby -v: 2.3.0dev (2015-05-07 trunk 50439) * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- The source of this bug is here: https://github.com/rails/rails/issues/22171#issuecomment-155090007 behaviour between `DateTime.parse` and `Time.parse` is inconsistent when it comes to parsing ISO8601 without letter "Z" ~~~ruby irb(main):003:0> time = "2015-11-20T03:05:30" => "2015-11-20T03:05:30" irb(main):005:0> Time.parse(time) => 2015-11-20 03:05:30 +0800 irb(main):007:0> DateTime.parse(time) => #<DateTime: 2015-11-20T03:05:30+00:00 ((2457347j,11130s,0n),+0s,2299161j)> ~~~ Time.parse returns time in local timezone, while `DateTime.parse` returns it in UTC. According to specification, without letter "Z" in the end, the time should be in local timezone (so `Time` class is correct and `DateTime` is wrong) Is this a bug or for some reason this is intended behaviour? -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>