Re:Ten Python datetime pitfalls, and what libraries are (not...
by Hackbraten on Sunday February 18, 2024 @04:01PM
(#39423288)
> Convert to UTC, add three hours, convert back to target timezone
What if you don't even know the target offset?
You may happen to know it for an event three hours in the future, but what if you're adding three months? With that time frame, the relevant laws even may not have been passed yet.
Since you know the offset then adding three hours should be unambiguous no? Convert to UTC, add three hours, convert back to target timezone, which would net you the correct 05:00:00+02:00.