// this function convert date from YYYY-MM-DD to DD-MM-YYYY in order to use in HTML table for example
function mysql2table($date) {
$new = explode(”-”,$date);
$a=array ($new[2], $new[1], $new[0]);
return $n_date=implode(”-”, $a);
}
// this function convert date from DD-MM-YYYY to YYYY-MM-DD in order to use in MySQL table in DATE format for example
function table2mysql($year,$month,$day) {
if ($day<=9) { $day=”0″.$day; }
if ($month<=9) { $month=”0″.$month; }
$a=array ($year, $month, $year);
return $n_date=implode(”-”, $a);
}

Add A Comment