Date methods

Provides a reference of date methods in IBM ILOG Script.

Table 1. Date methods
Syntax Effect

date.getTime()

date.setTime(milliseconds)

Returns (or sets) the number of milliseconds since 00:00:00 UTC, January 1, 1970.

Example: Suppose that the date d has been created with:

d = new Date(3427)

Then:

d.getTime() –> 3427

date.toLocaleString()

date.toUTCString()

Returns a string representing the date in local time or in UTC respectively.

Example: Suppose that the date d has been created with:

d = new Date("3/12/1997 12:45:00 0")

Then:

d.toLocaleString() –> "03/12/1997 12:45:00 000"

d.toUTCString() –> "03/12/1997 10:45:00 000"

assuming a local time zone offset of +2 hours with respect to Greenwich Mean Time.

date.getYear()

date.setYear(year)

Returns (or sets) the year of date.

date.getMonth()

date.setMonth(month)

Returns (or sets) the month of date.

date.getDate()

date.setDate(day)

Returns (or sets) the day of date.

date.getHours()

date.setHours(day)

Returns (or sets) the hours of date.

date.getMinutes()

date.setMinutes(minutes)

Returns (or sets) the minutes of date.

date.getSeconds()

date.setSeconds(seconds)

Returns (or sets) the seconds of date.

date.getMilliseconds()

date.setMilliseconds(millisecs)

Returns (or sets) the milliseconds of date.
date.toString() Returns the same value as date.toLocaleString()