Location: PHPKode > scripts > Convert Date > convert-date.php
// This is a function to convert date from DD-MM-YYYY to YYYY-MM-DD :

function ctomysql($date) {
 
  $date = explode("-",$date);
  if ($date[0]<=9) { 
	$date[0]="0".$date[0]; 
  }
  if ($date[1]<=9) {
	$date[1]="0".$date[1]; 
  }
  $date = array($date[2], $date[1], $date[0]);
 
  return $n_date=implode("-", $date);
}


// This is a function to convert date from YYYY-MM-DD to DD-MM-YYYY:
// You can use also MySQL function DATE_FORTMAT();
function cfmysql($date) {
      
  $new = explode("-",$date);
  $a=array ($new[2], $new[1], $new[0]);
 
  return $n_date=implode("-", $a);
}

Return current item: Convert Date