Friday, September 3, 2010

Django: Formate datetime.now() to Unix timestamp

To convert the datetime object to a Unix timestamp using Django:

from django.utils.dateformat import format

timestamp_string = format(datetime.now(), u'U')

slidedog
Now go forth and be happy!

No comments:

Post a Comment

Leave your thoughts ...

---
If you are having trouble with copy/pasting in comments, you need to sign in or click 'Preview'.

For more information about this Firefox bug, see here.