Answers for "how to change php date format in month name"

PHP
7

php change date format

To convert the date-time format PHP provides strtotime() and date() function. We change the date format from one format to another.

Change YYYY-MM-DD to DD-MM-YYYY
<? php.
$currDate = "2020-04-18";
$changeDate = date("d-m-Y", strtotime($currDate));
echo "Changed date format is: ". $changeDate. " (MM-DD-YYYY)";
?>
Posted by: Guest on April-18-2020
0

php convert month number to name

$monthNum  = 3;
$dateObj   = DateTime::createFromFormat('!m', $monthNum);
$monthName = $dateObj->format('F'); // March
Posted by: Guest on July-06-2020

Code answers related to "how to change php date format in month name"

Browse Popular Code Answers by Language