Skip to content

Instantly share code, notes, and snippets.

@graingert
Created July 24, 2014 11:46
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 graingert/f6afcee84baa498fbcd6 to your computer and use it in GitHub Desktop.
Save graingert/f6afcee84baa498fbcd6 to your computer and use it in GitHub Desktop.
>>> from django.conf import settings
>>> from django.template import Context, Template
>>> settings.DATETIME_FORMAT
'D j m Y H:i (e)'
>>> Template('{{deadline|date:"DATETIME_FORMAT"}}').render(Context({"deadline": datetime.datetime.now}))
u'July 24, 2014, 11:45 a.m.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment