A Python script running on a server in NYC receives a stream of live data from a websocket API where only the time is given, eg: 8:21:56
. The provided time is in the timezone Asia/Chongqing
which is UTC +08:00
. The local server is in the timezone America/New_York
which is UTC -05:00
.
This means that the dates in both timezones are different for 12-13 hours every day depending on daylight savings.
Question: Knowing that my server is in a different timezone, how can I find the date needed to convert the time into an appropriate datetime? Eg: If the local date on the server is 2015-12-05
, convert 8:21:56
to 2015-12-06 7:36:56.000Z
in the UTC timezone.