Skip to content

Instantly share code, notes, and snippets.

@walterrenner
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterrenner/7134d5407c6a1781bb1f to your computer and use it in GitHub Desktop.
Save walterrenner/7134d5407c6a1781bb1f to your computer and use it in GitHub Desktop.
Common Python datetime formatting strings
# A complete list of available directives id available on:
# https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior
from datetime import datetime
now = datetime.now()
print now.strftime('%d. %b %Y') # 17. Sep 2014
print now.strftime('%d.%m.%y') # 17.09.14
#"%D %d %M %Y" -> 'Wed 09 Jan 2008'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment