JavaScript timestamp to Python datetime conversion

前端 未结 3 2072
滥情空心
滥情空心 2020-12-03 00:29

To get timestamp in JavaScript we use

var ts = new Date().getTime()

What is the proper way to convert it to a Python datetime

3条回答
  •  清歌不尽
    2020-12-03 01:09

    The way you do it is the correct way, because js includes milliseconds in the date/time. Python (and PHP) as far as I know, don't. For more precision you could use /1000.0.

提交回复
热议问题