Changing a unix timestamp to a different timezone

后端 未结 3 715
旧巷少年郎
旧巷少年郎 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:30

    pytz might help you out here. Like viraptor said, ideally you'd store all your datetimes as unix UTC timestamps, and only localize the time when you print it out.

提交回复
热议问题