Forked from eculver/Simple reversible datetime representation
Created
February 14, 2018 17:42
-
-
Save notjamesheck/59637aacecc109deeabd0e5ff9463759 to your computer and use it in GitHub Desktop.
Basic conversion of python datetime to string and back
This file contains hidden or 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
| import datetime | |
| fmt = '%Y%m%d%H%M%S' # ex. 20110104172008 -> Jan. 04, 2011 5:20:08pm | |
| now_str = datetime.datetime.now().strftime(fmt) | |
| now_datetime = datetime.datetime.strptime(now_str, fmt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment