How to change django datetime format output?

I have a datetime object. This is my template file:

<li>{{ sale.validity }}</li>

and the output i'm getting is in the format:

July 18, 2012, midnight

I would really like to change the output to be numerical in the format: day-month-year so for example the above would be changed to:


Can someone point me out to the right direction on this?


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.

Need Your Help

IE & Firefox - custom drop down could not remove native arrows

css internet-explorer custom-controls mozilla

I'm trying create a custom drop down control and I need to hide the arrows from the native controls. I'm using the following CSS, which is working for Chrome and Safari, but not in Mozilla and IE.