0

I have a date of the type

August 15, 2009

I'm trying to parse it with

DATE_FORMAT('August 15, 2009', '%M %e, %Y')

But it is not working returns NULL.

Oh mighty overflowers, do you have any idea what might be the problem?

2
  • I've edited to question to explain the problem. Commented Jun 2, 2011 at 8:00
  • Thank you :) You are right your edit makes more sense in a strict way, and we need to be strict when it comes to programming. Commented Jun 2, 2011 at 8:30

1 Answer 1

8

See http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format

mysql> SELECT STR_TO_DATE('May 1, 2013','%M %d,%Y');
        -> '2013-05-01'
Sign up to request clarification or add additional context in comments.

2 Comments

More specifically, DATE_FORMAT() expects a date, that's why it's unsuitable for the task.
Thanks I hadn't considered that :) Should have looked closer at the manual :)

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.