I know another answer was accepted a while ago, but this question appears high on Google's search results, so I will add another answer.
If you are working at the template level, you can use the U
parameter to the date
filter, e.g.:
{{ mydate|date:"U" }}
Note that it will be based upon the TIMEZONE
in your settings.py.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…