<?php $date_str = "10-01-2021"; $full_date= strtotime($date_str); echo date('d F Y', $full_date); //PRINT- 10 January 2021 ?>
In the code snippet, we want to convert our date string '10-01-2021' to '10 January 2021'. To do this we use strtotime() method of PHP to convert the date string and then pass its value to the PHP date() function.
You can change 'd F Y' value according to your requirement. Like if you only want month name and year you can use
<?php echo date('F Y', $full_date); //PRINTS- January 2021 ?>