How to Convert date format yyyy-mm-dd => dd-mm-yyyy using PHP

0

Convert date from YYYY-MM-DD to DD-MM-YYYY (and from DD-MM-YYYY to YYYY-MM-DD).

The timestamp which is used as a base for the calculation of relative dates.

Use strtotime() and date()

Code

$Date = "2018-01-25";
$newDate = date("d-m-Y", strtotime($Date));