Skip to content

Instantly share code, notes, and snippets.

@jigewxy
Last active December 15, 2019 10:00
Show Gist options
  • Save jigewxy/654f1539a09ee8c5c3da9a33ec0b8ab1 to your computer and use it in GitHub Desktop.
Save jigewxy/654f1539a09ee8c5c3da9a33ec0b8ab1 to your computer and use it in GitHub Desktop.
import datetime
now = datetime.datetime.now()
print(now.strftime('%Y-%m-%d-%H-%M-%S'))
print(now.strptime('09/19/18 13:55:26','%m/%d/%y %H:%M:%S'))
# strftime convert time to string format; strptime convert string to given format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment