From: sonots@... Date: 2016-03-17T16:38:49+00:00 Subject: [ruby-core:74434] [Ruby trunk Bug#12190] DateTime.strptime and Time.strptime does not have compatibility in terms of parsing timezone Issue #12190 has been updated by Naotoshi Seo. PRed https://github.com/ruby/ruby/pull/1297 ---------------------------------------- Bug #12190: DateTime.strptime and Time.strptime does not have compatibility in terms of parsing timezone https://bugs.ruby-lang.org/issues/12190#change-57553 * Author: Naotoshi Seo * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin13] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- For CET, only DateTime.strptime successfully parsed timezone ``` irb(main):003:0> DateTime.strptime('2015-11-12 CET', '%Y-%m-%d %Z') => # irb(main):004:0> Time.strptime('2015-11-12 CET', '%Y-%m-%d %Z') => 2015-11-12 00:00:00 +0900 ``` For JST also, only DateTime worked. ``` irb(main):005:0> ENV['TZ'] = 'UTC' => "UTC" irb(main):006:0> DateTime.strptime('2015-11-12 JST', '%Y-%m-%d %Z') => # irb(main):007:0> Time.strptime('2015-11-12 JST', '%Y-%m-%d %Z') => 2015-11-12 00:00:00 +0000 ``` For PST, both worked. ``` irb(main):004:0> DateTime.strptime('2015-11-12 PST', '%Y-%m-%d %Z') => # irb(main):003:0> Time.strptime('2015-11-12 PST', '%Y-%m-%d %Z') => 2015-11-12 00:00:00 -0800 ``` I felt DateTime.strptime and Time.strptime should have compatibility. -- https://bugs.ruby-lang.org/ Unsubscribe: