w3resource
php Programming Exercies

PHP Date Exercises : Change month number to month name

PHP date: Exercise-12 with Solution

Write a PHP script to change month number to month name.

Sample Solution:

PHP Code:

<?php
$month_num = 7;
$month_name = date("F", mktime(0, 0, 0, $month_num, 10));
echo $month_name."\n"; 
?>

Sample Output:

July

N.B.: The result may varry for your system date and time.

Flowchart :

Flowchart: Change month number to month name

PHP Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a PHP script to get time difference in days and years, months, days, hours, minutes, seconds between two dates.
Next: Write a PHP script to get yesterday's date.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming