Created
August 20, 2020 09:01
-
-
Save traderbagel/cbc020ac7861d6dacad084f7c15288d9 to your computer and use it in GitHub Desktop.
python datatime to timestamp and vice-versa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
ts = 1597809600 | |
dt = datetime.fromtimestamp(ts) | |
# current date and time | |
now = datetime.now() | |
ts = datetime.timestamp(now) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment