0

I want convert custom string time on UTC between different time zones defined as GMT.

I general all answers that is here ok. But some question is with this examples:

1.TZ='GMT-07' date --date='TZ="UTC" 00:34'

07:34:00 +0700

2.TZ=':America/Vancouver' date --date='TZ="UTC" 00:34'

17:34:00 -0700

Why differ result when I try use GMT for destination TZ?

This City have same GMT.

P.S. So I found solution with GMT destination on result by time and wrong TZ display.

TZ='UTC' date --date='TZ="GMT-07" 00:34' 

17:34:00 +0000

lexxai
  • 1

1 Answers1

1
TZ='GMT-07'
TZ=':America/Vancouver'

The claim that these are the same is false. The first one is a POSIX-style rule that describes a timezone (with the abbreviation "GMT") that is 7 hours ahead of UTC in standard time and that has no daylight savings time shift. The negative number means ahead of UTC.

Vancouver is in the Pacific timezone and is 8 hours behind UTC in standard time and 7 hours behind it in daylight savings time. The correct POSIX-style rule, simplifying the actual complexities of Canadian law as POSIX-style rules do, is PST8PDT.

Further reading

  • man tzset
JdeBP
  • 68,745