wrong date format used for mysql - how to fix it

Joined
12 Feb 2006
Posts
17,380
Location
Surrey
i have the date saved as a variable and in the format of DD/MM/YYYY on my database, however for me to use DAYOFWEEK on the date, this format doesn't work and it needs to be YYYY-MM-DD.

it'll be too much work to go back and edit the way the date is saved, and then all the place it's queried and used, so hoping to find a solution with what i've got.

is there a way to make the below work.

$daySent = 1

$sql="select count(DISTINCT(postcode)) as total from quotes WHERE DAYOFWEEK(date) = '$daySent' ";

i'm basically looking to count how many quotes we've ever had for fridays, wednesdays etc.

thanks
 
Back
Top Bottom