On Mon, Jan 17, 2022 at 09:10:59PM +0100, Girod Valentin wrote: > Description: > when using date -d @customNumber +%H, > it returns 1 more hour that the expected hour.
First thing to note: date(1) is not part of bash. It's part of GNU coreutils, if you're on a GNU/Linux system. You're reporting this in the wrong place. > Repeat-By: > date -d @0 +%T > returns: 01:00:00 (WHAT THE FUCK) > excpected output: 00:00:00 This result depends on your time zone. @0 represents the Unix epoch, which is 00:00:00 Januay 1, 1970 UTC. If you're in UTC, then you'll get the result you expect. unicorn:~$ date -d @0 +%T 19:00:00 unicorn:~$ date -u -d @0 +%T 00:00:00 The -u option forces the UTC time zone. You could do the same thing with the TZ variable. > date -d @18130 +%T > returns: 06:02:10 > expected output: 05:02:10 You're apparently in a time zone that's 1 hour ahead of UTC. I think a large chunk of Europe is in that time zone. unicorn:~$ date -d @18130 +%T 00:02:10 unicorn:~$ TZ=UTC date -d @18130 +%T 05:02:10 unicorn:~$ TZ=Europe/Paris date -d @18130 +%T 06:02:10