Ask Question

Menu

Need MCA Or B.tech College Project Contact Us: +91 9437911966 (Whatsapp) Students Tutorial


How to convert string number into month name in PHP


<!DOCTYPE html>
<html>
<body>
<?php
    $monthNum  = 1;/*Here 1 is the month number*/
	$dateObj   = DateTime::createFromFormat('!m', $monthNum);/*Convert the number into month name*/
	$monthName = $dateObj->format('F');
	echo $monthName;
?>
</body>
</html>

Output:

January