Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Date

The Date class represents a day of the year. Date instances are immutable. The constructors are accessible from scripts.

Fields

FieldTypeDescription
dayintegerRead only. The day, from 1 to 31.
monthintegerRead only. The month, from 0 to 11.
yearintegerRead only. The year.
weekdayintegerRead only. The day of the week, from 0 to 6.
daysFromSundayintegerRead only. The day of the week as a difference from Sunday: 0 for Sunday, 1 for Monday, etc.

Methods

init( )

Constructs a new Date instance for the current date.

init( year, month, day )

Constructs a new Date instance for the given year, month and day.

equals( object )

Returns True if object represents the same date as self.

compareTo( date )

Returns 0 if the date represented by the argument is equal to the date represented by this Date, less than 0 if the date of this Date is before the date represented by the argument, and greater than 0 if the date of this Calendar is after the date represented by the argument.

addDays( days )

Returns a new Date instance representing a date with the given number of days added to the date represented by this Date. The argument days can be negative.

addDays( workdays, workweek )

Returns a new Date instance representing a date with the given number of workdays added to the date represented by this Date and properly considering the Workweek represented by the parameter workweek. The argument workdays can be negative.