setMonth (JavaScript)

Sets the month in local time. Optionally sets the day.

Defined in

Date (Standard - JavaScript)

Syntax

setMonth(month:int) : long

setMonth(month:int, day:int) : long

Parameters Description
month The month in local time where 0 is January.
day The day of the month in local time where 1 is the first day of the month.
Return value Description
long The new time in numeric format.

Examples

This computed label sets the date to January 1 of the current year.
var date = new Date();
date.setMonth(0, 1);
date.toString()