class DateTimeField(**kwargs)
[source]
- Default widget:
DateTimeInput
- Empty value:
None
- Normalizes to: A Python
datetime.datetime
object. - Validates that the given value is either a
datetime.datetime
,datetime.date
or string formatted in a particular datetime 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.datetime
object.
If no input_formats
argument is provided, the default input formats are:
1 2 3 4 5 6 7 8 9 | [ '%Y-%m-%d %H:%M:%S' , # '2006-10-25 14:30:59' '%Y-%m-%d %H:%M' , # '2006-10-25 14:30' '%Y-%m-%d' , # '2006-10-25' '%m/%d/%Y %H:%M:%S' , # '10/25/2006 14:30:59' '%m/%d/%Y %H:%M' , # '10/25/2006 14:30' '%m/%d/%Y' , # '10/25/2006' '%m/%d/%y %H:%M:%S' , # '10/25/06 14:30:59' '%m/%d/%y %H:%M' , # '10/25/06 14:30' '%m/%d/%y' ] # '10/25/06' |
See also format localization.
Please login to continue.