JavaScript: getUTCMonth() method

Author: Ronald S. Holland
Total Application Works


To contact us

[HOME] [Consulting] [Design] [Maintenance] [Project] [Testing] [Training] [Turnkey] [Java] [C++] [SQL] [HTML] [JavaScript ]

© 2002 - 2010 All Rights Reserved Total Application Works

  • Tell a friend about this site (copy and paste the following HTML page into a file (e.g., using Notepad).)
  • <html>
    <title>Example of a link </title>
    <a href="">
    Lists and their Tags </a>

JavaScript Date Object


The purpose of this tutorial is to introduce and briefly describe JavaScript functions. This tutorial assumes that you have read and mastered my tutorials on:

  1. Table Tags
  2. Form Tags
  3. Introduction to JavaScript
  4. JS: basic Calculator
  5. JS: Functions
This tutorial assumes that you have some prior programming experience. It is not intended to be a comprehensive discussion on JavaScript or programming. In this tutorial, we will briefly discuss functions, as we ease into JavaScript, and build on what we learned in JS: Functions (see ref. 5 above). In the next section, we will briefly describe JavaScript basics.

What is JavaScript?

JavaScript is a scripting language developed by Netscape that enables Web designers to create interactive sites/web pages. JavaScript and Java have many features and structures in common, however, they were developed independently. When JavaScript embedded within HTML source code, it enables Web designers to spice up their sites with dynamic content. JavaScript is used in Web pages designers to:

  • Improve the Web page dynamic content design;
  • Add interactivity to HTML pages;
  • Validate forms and gather data from users;
  • Detect browsers;
  • Create cookies;
  • Etc.
JavaScript is a scripting/interpreted language, which can execute without having to compile the source code. Java and JavaScript are similar but are not the same. They are two completely different languages in both concept and design. It runs on the client's computer and does not require constant downloads from your web site.

What is a JavaScript getUTCMonth() method?

The JavaScript Date object is responsible for JavaScript's date and time handling. The following table contains the Date object method used in this tutorial and a brief description of its functionality/behavior.

Date Object Methods
Method Description
getUTCMonth() Returns the month from a Date object (from 0-11), from a Date object
Figure 1: getUTCMonth() method

How do you use the JavaScript getUTCMonth() method?

Figure 2 shows you how to use the getUTCMonth() method. A variable named myDate is created and the date values are stored in it.

Date Object Methods
Example of Using getUTCMonth() code Demo of getUTCMonth() code

<script type="text/javascript">
function get_UTCMonth() {
   var myDate = new Date();
   alert( "Value of my getUTCMonth()  in myDate " + 
         myDate.getUTCMonth()  ) ;
       "Value of getUTCMonth() in myDate " + 

<button onclick="get_UTCMonth()"> 
     Value of getUTCMonth() in myDate  </button>

<div id="getUTCMonthtxt"> </div>


Figure 2: getUTCMonth() method

Note: The Universal Coordinated Time (UTC) is the time set by the World Time Standard.

After the Value of getUTCMonth() button is pressed, the following is displayed.


Scripting language


    Functions are self-contained modules that perform a specific task. For those who have some familiarity with programming, some functions that you've had experience with are:

    Function Description Example
    sqrt(x) square root of x 30 = sqrt(900)
    exp(x) exponential function ex 2.178282 = exp(1.0)
    log(x) natural logarithm of x (base e) 1.0 = log(2.178282)
    log10(x) logarithm of x (base 10) 1.0 = log10(10.0)
    pow(x , y) x raised to the power of y 128 = pow(2 , 7)

[HOME] [Consulting] [Design] [Maintenance] [Project] [Testing] [Training] [Turnkey] [Java] [C++] [SQL] [HTML] [JavaScript ]

To contact us

© 2002 - 2010 All Rights Reserved Total Application Works