I declared DateTimeField in my model.py
date = models.DateTimeField(db_index=True, auto_now_add=True)
I show this value in my template as follows:
{{comment.date}}
and this is how it is displayed:
Feb. 9, 2014, 2:18 p.m.
Apparently, the django template engine formats DateTimeField
automatically because the server returns this data with the following values:
2014-02-09 14:18:54.721021+00:00
But how can I do to return this value generated from the server?
I am making an AJAX call to the server and the date it naturally returns without format. Since I have a javascript file outside of the template, I cannot just do it {{comment.date}}.
source
share