I’m often in the position of wanting to extract the UTC time for a timezone-agnostic datestamp, in a particular timezone. I don’t want to “convert” the stamp to the target timezone, I want the library to assume this datestamp is already in a target time zone, and give me the UTC time it would fall in.
Lets say my time zone is: Europe/Amsterdam
I want:
‘2023-09-20 10:00:00’ in America/New_York. So I want to tell the library “This date is 10am on 9/20/23 in America/New_York. What is the Unix timestamp?”
Any strategy I try ends up converting that time to a different time in the target timezone. (GMT+2 to GMT-4). Because of daylight savings time, I can’t add a timezone offset to the original datestamp. The offset changes throughout the year.
Does anyone have a strategy for this?