The best way is to convert the dateformat direct in your Querystring:
$TimeFormat = "%m/%d/%Y"; // your pref. Format
$sql = "SELECT DATE_FORMAT(DateCol , '" . $TimeFormat . "') as ConvertDate FROM tblTest";
Otherwise you can modify this function to your needs:
function format_date($original, $format) {
if (empty($original)) {
$original = date("Y-m-d H:i:s");
}
$original = ereg_replace("30 Dez 1899", "30-01-1973", $original);
$format = ($format=='date' ? "%m-%d-%Y" : $format);
$format = ($format=='germandate' ? "%d.%m.%y" : $format);
$format = ($format=='germandaydate' ? "%A, %d.%m.%Y" : $format);
$format = ($format=='germantime' ? "%H:%M" : $format);
$format = ($format=='germandatetime' ? "%d.%m.%y %H:%M:%S" : $format);
$format = ($format=='datetime' ? "%m-%d-%Y %H:%M:%S" : $format);
$format = ($format=='mysql-date' ? "%Y-%m-%d" : $format);
$format = ($format=='mysql-datetime' ? "%Y-%m-%d %H:%M:%S" : $format);
$format = ($format=='mssql-date' ? "%Y%m%d" : $format);
$format = ($format=='mssql-datetime' ? "%Y%m%d %H:%M:%S" : $format);
$format = ($format=='Ymd' ? "%Y-%m-%d" : $format);
return !empty($original) ? strftime($format, strtotime($original)) : "";
}