[wd_asp elements=’search’ ratio=’100%’ id=1]

Date convert format from dd/mm/yy to yyyy-mm-dd

4th July 2013

Php - Dates & Time

php codehaven

Another version to create new time format is here

Convert to any format

$mydate="Feb 12 1998 12:00AM";
echo date('d/m/Y', strtotime($mydate));

Reverse timestamp format, this will just show ’27-02-2015′.


$joindate = "2015-02-27 14:05:24"
$joindate = date('d-m-Y H.i.s', strtotime($joindate));
$joindate = substr($joindate,0,10);

This outputs 2013-07-12

$dates= "12/07/13";
$dates = mysql_real_escape_string($_POST['dates']);

$dates = DateTime::createFromFormat('d/m/Y', $dates);
echo $dates = $dates->format('Y-m-d');

If this does not work for you try this!
$time =explode("-","12-04-2008");
krsort($time);
print "

".implode("/",$time)."

";