Python – Setting a datetime in a specific timezone (without UTC conversions)
There are at least two issues: you shouldn’t pass a timezone with non-fixed UTC offset such as “US/Pacific” as tzinfo parameter directly. You should use pytz.timezone(“US/Pacific”).localize() method instead .strftime(‘%s’) is not portable, it ignores tzinfo, and it always uses the local timezone. Use datetime.timestamp() or its analogs on older Python versions instead. To make a … Read more