Project

General

Profile

Actions

Bug #12189

closed

DateTime#to_time removes timezone information

Added by sonots (Naotoshi Seo) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin13]
[ruby-dev:49521]

Description

irb(main):004:0> DateTime.strptime('2015-11-12 CET', '%Y-%m-%d %Z')
=> #<DateTime: 2015-11-12T00:00:00+01:00 ((2457338j,82800s,0n),+3600s,2299161j)>
irb(main):005:0> DateTime.strptime('2015-11-12 CET', '%Y-%m-%d %Z').to_time
=> 2015-11-12 08:00:00 +0900

I think it is better to preserve timezone information as 2015-11-12 00:00:00 +0100

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0