Project

General

Profile

Actions

Bug #11755

closed

ENV['TZ'] timezone

Added by xiejiangzhi@gmail.com (Jon Xie) over 8 years ago. Updated over 8 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
[ruby-core:71766]

Description

2.2.3 :001 > Time.now
 => 2015-12-01 11:35:06 +0800 
2.2.3 :002 > ENV['TZ'] = 'GMT+8'; Time.now
 => 2015-11-30 19:35:18 -0800 
2.2.3 :003 > ENV['TZ'] = 'GMT-8'; Time.now
 => 2015-12-01 11:35:24 +0800

Why is this so?

Updated by xiejiangzhi@gmail.com (Jon Xie) over 8 years ago

System: OS X 10.10.5

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Subject changed from ENv['TZ'] timezone to ENV['TZ'] timezone
  • Description updated (diff)
  • Status changed from Open to Feedback

Seems correct output.
What do you expect?

Updated by xiejiangzhi@gmail.com (Jon Xie) over 8 years ago

Nobuyoshi Nakada wrote:

Seems correct output.
What do you expect?

I'm expect:

ENV['TZ'] = 'GMT+8'; Time.now
 => 2015-12-01 11:35:06 +0800

What reason is this excuse me?

Updated by phluid61 (Matthew Kerwin) over 8 years ago

Jon Xie wrote:

What reason is this excuse me?

Presumably you took 12 seconds between the first two commands, and then another 6 between the second and third. The clock keeps on ticking...

Updated by xiejiangzhi@gmail.com (Jon Xie) over 8 years ago

Matthew Kerwin wrote:

Jon Xie wrote:

What reason is this excuse me?

Presumably you took 12 seconds between the first two commands, and then another 6 between the second and third. The clock keeps on ticking...

I'm sorry, I didn't describe clearly....

I think timezone should be '+0800'

ENV['TZ'] = 'GMT+8'; Time.now
 => 2015-12-01 11:35:06 +0800

And then it was '-0800 '

ENV['TZ'] = 'GMT+8'; Time.now
 => 2015-11-30 19:35:18 -0800

Updated by xiejiangzhi@gmail.com (Jon Xie) over 8 years ago

TZ database https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
'Etc/GMT+8' corresponding UTC is '-08:00'

@Nobuyoshi Nakada @matthew (Matthew Johnson) Kerwin thanks

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Status changed from Feedback to Third Party's Issue

It's the convention.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0