On Mon, Dec 18, 2023 at 06:02:48AM +0000, Albretch Mueller wrote: > On 12/18/23, David Wright <deb...@lionunicorn.co.uk> wrote: > > Another problem in what you posted is that you sometimes run date > > in your local timezone (generally for the "now" times), but you > > append +00:00 as the timezone for those --date strings that you > > construct from several substrings. You need to use UT throughout. > > What difference would that make when all I need is a time difference? > The way I understand such time format issues is that it needs to just > be the same in the two dates.
The only advantage of storing timestamps in a human-readable format would be that you, the human, can read them and know what they mean. If you wreck this by putting the wrong timezone offset on your human-readable times, then they're no longer human-readable. So there is literally NO point in doing all this stupidly difficult formatting and parsing work, when you could just use seconds-since-epoch format instead. In addition to that, a case has already been shown where your chosen format, with or without a fixed timezone offset, is ambiguous -- it could refer to two different times. This is an issue everywhere daylight saving time is used. It's rare, but it's real.