getUTCMonth (JavaScript)
Gets the month in UTC.
Defined in
Date (Standard - JavaScript)Syntax
getUTCMonth() : int
Return value | Description |
---|---|
int |
The month where 0 is January. |
Examples
This computed label adds one year to the current date. One day is first subtracted if the date is February 29 (leap year) so it appears as February 28 instead of March 1 in the next year.// Next year same time
var date = new Date();
if(date.getUTCMonth() == 1) // if Feb
if(date.getUTCDate() > 28) // if Feb 29
date.setUTCDate(date.getUTCDate() - 1);
date.setUTCFullYear(date.getUTCFullYear() + 1);
date.toUTCString()