SelectDateWidget is very convenient but it normally seems to return dates in the format "%Y-%m-%d". It doesn't take a format parameter and doesn't have much documentation. Anyone run into this or have an idea how to work around it to get the output of the date into another format? There is this ticket, #6231 saying that there's a fix to have it use a DATE_FORMAT setting from settings.py (though I don't see why it can't just be given a format parameter also). There's a patch in the ticket from 2 months ago to implement this, so it seems I would have to get the latest dev version of django to use it, unless there is a way I can apply just this patch to my django install?
DATE_FORMAT works with SelectDateWidget but you have to use format strings without percents (as used in: now template tag) like this:
DATE_FORMAT = 'j N Y'
Have you tried this setting yet ? According to the docs, it seems DATE_FORMAT=
has been a valid setting since version 1.0. Are you using a pre-1.0 version of django?
http://docs.djangoproject.com/en/1.0/ref/settings/#date-format
The correct way to do this is with spaces rather than forward slashes i.e.
DATE_FORMAT = "%d %m %Y"
来源:https://stackoverflow.com/questions/1554783/date-format-for-djangos-selectdatewidget