PeterErhard
asked on
PHP Convert dates
Can someone help with the syntax to convert dates such as 06/09/2011 to 2011-09-06 please?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
$olddate = "06/09/2011";
$unixtimestamp = strtotime($olddate);
$newdate = date("Y-m-d",$unixtimestam p);
$unixtimestamp = strtotime($olddate);
$newdate = date("Y-m-d",$unixtimestam
Try this
echo date('Y-m-d', strtotime($strng))
echo date('Y-m-d', strtotime($strng))
<?php
$date = date_create_from_format('d/m/Y', '06/09/2011');
echo date_format($date, 'Y-m-d');
?>
Well, since you neglected to at least thank others who tried to help you, ....
You're welcome, anyway.
You're welcome, anyway.
will convert the string to a unix timestamp
http://us2.php.net/manual/en/function.date.php
will convert a unix timestamp to whatever date format you want.