Created
January 12, 2020 14:06
-
-
Save leewind/724358a7f84bcddf12a3915cc5b97c52 to your computer and use it in GitHub Desktop.
python string to datetime
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
| from datetime import datetime | |
| datetime_str = '09/19/18 13:55:26' | |
| datetime_object = datetime.strptime(datetime_str, '%m/%d/%y %H:%M:%S') | |
| print(type(datetime_object)) | |
| print(datetime_object) # printed in default format |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment