This is a followup question to
How can I convert the time stamp with timezone info to utc time in python
I was able to get the time string like this "2023-09-06T22:02:44-07:00" through calling
datetime.now().astimezone().isoformat(timespec='seconds')
I wonder whether there is a way to get the time string like "2023-09-06T22:02:44-PDT"? And also convert the time string to UTC time -- something like "2023-09-07T05:02:44-UTC"? Thanks!
Get the timezone-naive timestamp and append the timezone-aware
tznameto get your desired formator use
strftimewith%Z