Example of php code that returns month name based on month number

WBOY
Release: 2016-07-25 08:58:26
Original
1546 people have browsed it
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;
    } 
}
?>
Copy after login


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!