New submission from Olvin <olvinro...@protonmail.com>:
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. ---------- assignee: docs@python components: Documentation messages: 383328 nosy: docs@python, olvinroght priority: normal severity: normal status: open title: Minor improvement in datetime.timestamp() docs type: enhancement _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42679> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com