Date.getUTCMonth() : getUTCMonth : Date JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Date » getUTCMonth »

 

Date.getUTCMonth()







The getUTCMonth() method returns the month portion of the Date object converted to universal time and expressed as an integer from 0 (January) to 11 (December).












<html>
    <script language="JavaScript">
    <!--
    function getMonthString(num)
    {
      var month;    //Create a local variable to hold the string
      switch(num)
      {
        case 0:
          month="January";
          break;
        case 1:
          month="February";
          break;
        case 2:
          month="March";
          break;
        case 3:
          month="April";
          break;
        case 4:
          month="May";
          break;
        case 5:
          month="June";
          break;
        case 6:
          month="July";
          break;
        case 7:
          month="August";
          break;
        case 8:
          month="September";
          break;
        case 9:
          month="October";
          break;
        case 10:
          month="November";
          break;
        case 11:
          month="December";
          break;
        default:
        month="Invalid month";
      }
      return month;
    }
    theDate = new Date();
    document.write("The UTC month is ",theMonthString(theDate.getUTCMonth()));
    -->
    </script>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Date
» getUTCMonth