Print month given integer
Snippet
Posted by kitt at 13:47 on 25 April 2013
Sometimes you want to print a month without knowing the complete date (say, given 7 from the URL, you want July).
<?php print date('F', mktime(0, 0, 0, $month, 1)); // mktime(hour, minute, second, month, day, year) // you don't care about the year. $month = 6; print date('F', mktime(0, 0, 0, $month, 1)); /* * outputs * June * for 6/1 at 12:00:00 am midnight */
Add new comment