I have a DateTimeField
with auto_now_add=True
and everything work except when i try to use that date in a template i get a date which is in the format of 'June 23, 2018, 4:33 p.m.' but the date that I need should be formatted like this DD-MM-YY / hh:mm.
Any suggestions ?
Asked
Active
Viewed 1,039 times
1

RaoufM
- 525
- 5
- 22
1 Answers
1
You can use the date
filter in the template for this. For example, for your answer:
<html>
<head></head>
<body>
<p>{{pub_date|date:"d-m-y / H:i"}}</p>
</body>
</html>
Here's the complete list of formatting characters: Django, Built in Template tags

Shameer Kashif
- 424
- 3
- 16