Changing a unix timestamp to a different timezone

后端 未结 3 722
旧巷少年郎
旧巷少年郎 2020-12-19 07:07

I retrieve a unix timestamp from a web service in a Python program. This timestamp is in a USA timezone. In order to insert it in a MySQL database with other objects, locali

3条回答
  •  醉酒成梦
    2020-12-19 07:35

    If it's really a unix timestamp, then it's UTC based. Just interpret it correctly for your use case. Apply the timezone translation only when you have to print this date as text.

    If you're storing it as timestamp on your side too, keep it exactly as it is.

提交回复
热议问题