Skip to content

Instantly share code, notes, and snippets.

@xjxckk
Last active December 18, 2021 15:14
Show Gist options
  • Save xjxckk/c432e661faaf8567f35b32ce5e334897 to your computer and use it in GitHub Desktop.
Save xjxckk/c432e661faaf8567f35b32ce5e334897 to your computer and use it in GitHub Desktop.
Python datetime, use strftime.org as a reference
from datetime import datetime
date = 'Sat Nov 13 11:54:30'
date = datetime.strptime(date, '%a %b %d %H:%M:%S') # Sat Nov 13 11:54:30
date = date.strftime("%Y-%m-%d, %H:%M:%S") # 2021-11-13, 11:54:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment