Message383328
Answering question on StackOverflow I've found next example in docs of datetime.timestamp() ( https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp ) which returns UTC timestamp:
timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)
While it works I think there's more explicit way using timedelta.total_seconds() :
timestamp = (dt - datetime(1970, 1, 1)).total_seconds()
In same article few lines above there's example using total_seconds() so I think it will be good to use same method in both examples. |
|
Date |
User |
Action |
Args |
2020-12-18 21:36:55 | olvinroght | set | recipients:
+ olvinroght, docs@python |
2020-12-18 21:36:55 | olvinroght | set | messageid: <1608327415.79.0.704757539161.issue42679@roundup.psfhosted.org> |
2020-12-18 21:36:55 | olvinroght | link | issue42679 messages |
2020-12-18 21:36:55 | olvinroght | create | |
|