adjustHour (NotesDateTime - JavaScript)

Increments a date-time by a number of hours.

Defined in

NotesDateTime

Syntax

adjustHour(n:int) : void

adjustHour(n:int, preservelocaltime:boolean) : void

Parameter Description
n The number of hours by which to increment the date-time. Can be positive or negative.
preservelocaltime Affects adjustments that cross a daylight-saving time boundary. Specify true to increment or decrement the GMT time by one hour such that a 24-hour adjustment yields the same local time in the new day. If this parameter is false or omitted, GMT time remains as adjusted and local time gains or loses an hour.

Usage

If the NotesDateTime object consists of only a date component, this method has no effect.

The number of hours by which you increment a NotesDateTime object can cause the date component to be adjusted. For example, if the adjustment is +24, the date component changes to the next calendar day.

Examples

This button posts a start time given the current time and the elapsed hours, minutes, and seconds.
// Create valid NotesDateTime object and set to current time
var dt:NotesDateTime = session.createDateTime("Today 12");
dt.setNow();
// Get elapsed time
var hours = parseInt(requestScope.hour, 10);
var minutes = parseInt(requestScope.minute, 10);
var seconds = parseInt(requestScope.second, 10);
dt.adjustHour(-hours);
dt.adjustMinute(-minutes);
dt.adjustSecond(-seconds);
// Post start time
requestScope.startTime = dt.getLocalTime();