php转换日期格式手动dd / mm / yyyy [复制]

This question already has an answer here:

Use date()

$sqldate = "2016-07-18";
$newDate = date("d-m-Y",$sqldate);

I also use

implode('-', array_reverse(explode('/', $sqldate)));

I am trying to convert a date from yyyy-mm-dd to dd-mm-yyyy (but not in SQL); however I don't know how the date function requires a timestamp, and I can't get a timestamp from this string.

I am getting particular date format. WHY? I tried get a date expected format, i tried php date but no success..

I excpected output

18/07/2016
</div>

Use strtotime().

$sqldate = "2016-03-21";
echo $newDate = date("d/m/Y",  strtotime($sqldate));

Output

21/03/2016

Live Demo : Click Here

$sqldate = "2016-03-21";
$newDate = date("d-m-Y",strtotime($sqldate));

this is what you need.

 $sqldate = "2016-03-21";
 echo date('d/m/Y', strtotime($sqldate));