A month ago I set up a new server with Ubuntu 22 for a client, replacing an old one that had Ubuntu 18, which I upgraded to Ubuntu 20. The server has about tqo dozen scripts that I've developed and supported for the last six years. He's very happy with the setup.
However, I've been having some challenges with time zones with the new server. I did specify the Eastern (America/Toronto) time zone during installation, and this appeared to work (when logged in as a regular user), until I noticed that cron jobs were running at UTC time. Eventually I figured out I had to set the system time zone (see this post on Mastodon) using timedatectl set-timezone America/Toronto. There's still one script that was mis-behaving, though. The log file showed that the time period is was fetching transactions was correct ..
But the epoch values that were being used2024/06/03 07:02:02 INFO : Starting date is 2024-05-27 00:00:00 EDT 2024/06/03 07:02:02 INFO : Ending date is 2024-05-28 00:00:00 EDT
were UTC. ?!??!?..created[gte]=1716782400&created[lt]=1716868800
Naturally, I went back to the documentation at DateTime and saw that for the epoch method, it returns ".. the UTC epoch value for the datetime object." This is confusing to me, since I'm expecting an epoch value in the selected time zone. Those epoch values are four hours later than what I want, and this is messing things up for my client -- this code has worked fine for ~6 years, but is now broken.
I'm not asking for a fix (I know what I need to do), I'm just asking whether some concept was adjusted somewhere. Thanks.
In reply to SOLVED: DateTime's epoch method returns UTC value? by talexb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |