Last active
January 10, 2020 19:48
-
-
Save ycui1/84d73606750a3713ec23e8ec944e32d9 to your computer and use it in GitHub Desktop.
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 | |
datetime(2020, 1, 10, 13, 2, 0) | |
# a datetime object by specifying year, month, day, hour, minute, second | |
datetime.today() | |
# a datetime object with current date and time | |
datetime.now() | |
# the same as above when tz is None | |
datetime.utcnow() | |
# the same as above, but in the UTC (Coordinated Universal Time) | |
date_stamp = datetime.fromtimestamp(1578683037) | |
# a datetime object created using a POSIX timestamp | |
date_ordinal = datetime.fromordinal(734000) | |
# a datetime object created by specifying the number of days since year 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment