Home > Article > Backend Development > Example of php code that returns month name based on month number
This article introduces a piece of code that uses PHP to return the name of the month based on the month number. Friends in need can refer to it.
The following code implements this function: For example, the number 01 returns January, the number 02 returns February, and so on. The code is as follows: <?php /** * 根据月份数字返回月份名称 * edit bbs.it-home.org * date 2013/6/21 */ function Month($NumMonth) { switch($NumMonth) { Case "01": return "January"; break; Case "02": return "February"; break; Case "03": return "March"; break; Case "04": return "April"; break; Case "05": return "May"; break; Case "06": return "June"; break; Case "07": return "July"; break; Case "08": return "August"; break; Case "09": return "September"; break; Case "10": return "October"; break; Case "11": return "November"; break; Case "12": return "December"; break; } } ?> |