I have a datetime object. This is my template file:
- {{ sale.validity }}
and the output i\'m get
Per Django docs, you can use a date
filter to format date:
{{ sale.validity|date:"d-m-Y"}}
Additionally, you can also set DATE_FORMAT (or DATETIME_FORMAT) setting to set a project-wide default for displaying such values if USE_L10N
is False. If it's true, you'll want to have a look at this documentation on format localization.