class DateField(**kwargs)
[source]
- Default widget:
DateInput
- Empty value:
None
- Normalizes to: A Python
datetime.date
object. - Validates that the given value is either a
datetime.date
,datetime.datetime
or string formatted in a particular date format. - Error message keys:
required
,invalid
Takes one optional argument:
-
input_formats
-
A list of formats used to attempt to convert a string to a valid
datetime.date
object.
If no input_formats
argument is provided, the default input formats are:
['%Y-%m-%d', # '2006-10-25' '%m/%d/%Y', # '10/25/2006' '%m/%d/%y'] # '10/25/06'
Additionally, if you specify USE_L10N=False
in your settings, the following will also be included in the default input formats:
['%b %d %Y', # 'Oct 25 2006' '%b %d, %Y', # 'Oct 25, 2006' '%d %b %Y', # '25 Oct 2006' '%d %b, %Y', # '25 Oct, 2006' '%B %d %Y', # 'October 25 2006' '%B %d, %Y', # 'October 25, 2006' '%d %B %Y', # '25 October 2006' '%d %B, %Y'] # '25 October, 2006'
See also format localization.
Please login to continue.