[Answer]-Convert DateField to unix timestamp in Django

1👍

As the DateField() returns a native Python datetime.date instance, https://docs.python.org/2/library/datetime.html, it will be the same as converting a datetime.date object to a unix timestamp integer.. such as:

import time
import django.models as models

date = models.DateField()
unix_timestamp = int(time.mktime(date.timetuple()))

Leave a comment