In a model I have a such field: mydate = models.DateField()
now a javascript graph function requires unix timestamp such as "1196550000000", how can I return the unix timestamp of my mydate input.
Thanks
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.