I’m trying to patch a routine and I finally found the problem. I am given the following string:
$query = "SELECT title, DATE_FORMAT(event_date, '%Y-%c-%e') AS event_date FROM $dbTable WHERE event_date LIKE '$year-$month%'";
In the month variable at the end, for the months January through September I am returned 1 digit. So without disturbing the rest of the code, I would like to turn the month string into two digits but so far I have not been able to do that with the DATE_FORMAT function.
So in January, I am looking for the end result to look like:
$query = "SELECT title, DATE_FORMAT(event_date, '%Y-%c-%e') AS event_date FROM event WHERE event_date LIKE '2010-01%'";
I hope that makes sense.
Help would be appreciated.
WBR