[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63349: Bug in date when using UTC/GMT timeszones in the TZ variable
From: |
Andreas Schwab |
Subject: |
bug#63349: Bug in date when using UTC/GMT timeszones in the TZ variable |
Date: |
Sun, 07 May 2023 16:52:17 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Mai 07 2023, Eiríkur Hjartarson via GNU coreutils Bug Reports wrote:
> Now the "bug":
It's not a bug.
> $ TZ=Europe/Riga date --iso-8601=minutes -d "2024-01-01T00:00-05:00"
> 2024-01-01T07:00+02:00
>
> $ TZ=UTC+2 date --iso-8601=minutes -d "2024-01-01T00:00-05:00"
> 2023-01-01T03:00-02:00
>
> That is: the first command gives me the time and date in Riga when it's
> midnight at new year's eve in New York.
>
> The second command should do the same but instead gives the time in
> Godthab Greenland.
That's not how TZ works.
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
says about the offset:
Indicates the value added to the local time to arrive at Coordinated
Universal Time. ... If preceded by a '-', the timezone shall be
east of the Prime Meridian; otherwise, it shall be west (which may
be indicated by an optional preceding '+' ).
Thus TZ=UTC+2 means two hours before UTC.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."