Reputation: 711
Does anybody know something similar to function date() from PHP in Django?
I'm starting to learn this nice framework, I'm very happy with it (at the momment) but i haven't found that function
Upvotes: 1
Views: 361
Reputation: 76656
Yes.
Formats a date according to the given format.
Uses a similar format as PHP’s date() function (http://php.net/date) with some differences.
For example, you can do:
{{ value|date:"D d M Y" }}
If value is a datetime
object (e.g., the result of datetime.datetime.now()
), the output will be the string 'Jul 22 2013'
.
Documentation:
Upvotes: 2