Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to get month name by number

I have used this code in PHP to get month name by number its giving right answer in 01,02 upto 07 and saying wrong literal passes when I pass 08 and 09 for 11 and 12 as well giving right answer

$monthNum  = 09;
$monthName = date('F', mktime(0, 0, 0, $monthNum, 10));
echo $monthName

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

09 is invalid integer, you can’t have this. But if you want to keep it this way for some reason – use a string.
$monthNum = '09';

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading