There are two options you can use which are strtotime
or preg_split
and sprintf
. I recommend you use strtotime
. The structure goes like this:
$date = 'November 28 2009';
$sqldate = date('Y-m-d', strtotime($date));
Make sure the Y is capital so it reads as 0000 otherwise it will read 00.