JavaScript

addTime Method

Syntax

newDate = dateObj.addTime(interval, units)

Arguments

intervalstring

Defines the time interval to add. It can be one of the following:

  • year
  • quarter
  • month
  • week
  • day
  • hour
  • minute
  • second
unitsnumber

The number of interval to add to the date.

Description

Adds a length of time (year, months, hours) to a date.

Discussion

The addTime() is a method available for a JavaScript Date object in the Grid and UX Component.

Example

//add 1 year to a date object
var d1 = new Date();
d2 = d1.addTime('year',1);

//add 1 year, 3 months, 10 days to a date value
var d1 = new Date();
d2 = d1.addTime('year',1).addTime('month',3).addTime('day',10);

Limitations

Grid and UX Component Only