使用点分隔符将日期转换为另一种没有点的格式[重复]

This question already has an answer here:

From a JSON payload I get a date formatted like so: "2017.03.11". The desired result is: "11 MARCH 2017". I know how to remove the dots and convert the result into what I want using date(). But is there a more direct way to achieve it (without the step removing the dots)?

</div>

Try this:

$date = DateTime::createFromFormat('Y.m.d', '2017.03.11');

and then with the $date object you can do whatever you need.

This should do what you need.

<?php
$date = "2017.03.11";
$date1 = str_replace(".", "-", $date);
$date1 = strtotime($date1);
$date2 = date('d F Y',$date1);
echo $date2;
?>

2017.03.11    input
11 March 2017 output