getUTCMonth()  Date  instance method getterS2C Home  « Globals « Date « getUTCMonth()

Description

Returns the UTC month of the year (0-11) for the specified date.

Syntax

Signature Description
aDate.getUTCMonth()Returns the UTC month of the year (0-11) for the specified date.

Parameters

None.

Examples

The code below shows examples of the getUTCMonth() method of Date.


// Create a Date instance for the current date and time.
var todaysDate = new Date();
alert(todaysDate);

// Get UTC month as a number.
alert(todaysDate.getUTCMonth() + ' = UTC Month as a number');

// Use an array to display the UTC month as a string.
var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 
              'August', 'September', 'October', 'November', 'December']; 
alert(months[todaysDate.getUTCMonth()] + ' = UTC Month as a string');

Press the button below to action the above code:


Related Tutorials

JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times

go to home page Homepage go to top of page Top