0

There is u"'11/24/2013' value has an invalid date format. It must be in YYYY-MM-DD format error when submitted. should the date field be changed according to yyyy-mm-dd or any other solution.

2 Answers 2

1

Use YYYY-MM-DD. If you really want to have date strings floating about in a format of your choice, use:

datetime.strptime(time_string, "%m/%d/%Y").strftime("%Y-%m-%d")

to convert them when you need to.

Sign up to request clarification or add additional context in comments.

Comments

1

DATE_INPUT_FORMATS (docs) setting specifies the formats used to parse input dates.

The default equals to:

(
    '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
    '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
    '%d %b %Y', '%d %b, %Y',            # '25 Oct 2006', '25 Oct, 2006'
    '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
    '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.