#how to change the format of forms.DateField

3 messages · Page 1 of 1 (latest)

radiant rose
#

I am trying to enter the value of dates into my model.DateField value but when I take the value from the form it gives me format it takes value in mm-dd-yy I need to convert it to Yy-mm-dd

limpid basin
#

is it just about the display?

If so, you just have to format the field in the format accordingly:

my_date = forms.DateField(widget=forms.DateInput(format='%Y-%m-%d'))
radiant rose