function dateStringToDatepickerFormat($dateString)
{
$pattern = array(
//day
'd', //day of the month
'j', //3 letter name of the day
'l', //full name of the day
'z', //day of the year
//month
'F', //Month name full
'M', //Month name short
'n', //numeric month no leading zeros
'm', //numeric month leading zeros
//year
'Y', //full numeric year
'y' //numeric year: 2 digit
);
$replace = array(
'dd','d','DD','o',
'MM','M','m','mm',
'yy','y'
);
foreach($pattern as &$p)
{
$p = '/'.$p.'/';
}
return preg_replace($pattern,$replace,$dateString);
}