M.Ezz M.Ezz - 2 months ago 7
PHP Question

How to change date format from DD/MM/YYYY to YYYY-MM-DD?

How to change format of date string using PHP?

From:

06/16/2010


To:
2010-06-16

Answer
$date = "06/16/2010";
echo date('Y-m-d', strtotime($date)); // outputs 2010-06-16

Using the strtotime function.