It gives supports to the representation of an instant of specific time.

CONSTRUCTOR

Date()

It creates a set up instance with the instant the constructor was called.

Date (timeIntervalSinceNow: Double)

It creates a set up instance with the instant the builder was called adding the seconds indicated in the parameter ‘timeIntervalSinceNow’.

Arguments
timeIntervalSinceNow Double: seconds to add.

Date (timeIntervalSince1970: Double)

It creates a set up instance with the instant ´1 January 1970 at 00:00:00 UTC’ adding the seconds indicated in the parameter ‘timeIntervalSince1970’.

Arguments
timeIntervalSince1970 Double: seconds to add.

Date (year: Integer, month: Integer, day: Integer, hour: Integer, minutes: Integer, seconds: Integer, UTCOffset: Integer)

It creates a set up instance with and instant in UTC format using the parameters year, month, day, time, minutes. The UTCOffset parameter enables the addition of the difference in hours in relation to 0:00hs UTC to the instant.

Arguments
year Integer: year.
month Integer: month.
day Integer: day.
hour Integer: hours.
minutes Integer: minutes.
seconds Integer: seconds.
UTCOffset Integer: hours to add.
Exceptions
TimeZoneOffsetOutOfRange – Error trying to create a Date instance with an out of range timezone offset. Range must be between -18 to +18..

PUBLIC METHODS

Integer year()

It returns the year considering the Gregorian calendar and UTC timezone.

Return
Integer year.

Integer month()

It returns the number of month, considering the Gregorian calendar and UTC timezone.

Return
Integer month.

Integer day()

It returns the day, considering the Gregorian calendar and UTC timezone

Return
Integer day.

Integer hour()

It returns the hour, considering the Gregorian calendar and UTC timezone

Return
Integer hour.

Integer minutes()

It returns the number of minutes, considering the Gregorian calendar and UTC timezone.

Return
Integer minutes.

Integer seconds()

It returns the number of seconds, considering the Gregorian calendar and UTC timezone.

Return
Integer seconds.

Integer dayOfWeek()

It returns the day of week index, considering the Gregorian calendar and UTC timezone. Returns 0 for Mondays, 1 – Tuesday, … 6 on Sundays.

Return
Integer Day of week index, considering the convention:
0 – Monday, 1 – Tuesday, 2 – Wednesday, 3 – Thursday, 4 – Friday, 5 – Saturday, 6 – Sunday.

Double timeIntervalSinceNow()

It returns the second interval between the instant the instance was built and the instant of the call to the method.

Return
Double seconds.

Double timeIntervalSince1970()

It returns the second interval between the instant the instance was built and the instant ‘1 January 1970 at 00:00:00 UTC’.

Return
Double seconds.

Double timeIntervalSinceDate(Date date)

It returns the second interval between the instant in which the instance and the parameter instance were built.

Arguments
date Date: date refered to to work out the interval.
Return
Double seconds.

Date dateByAddingTimeInterval(Double segundos)

It returns a new Date instance resulting from adding up the instant the second instance of the parameter was built.

Arguments
seconds Double: seconds you wish to add.
Return
Date resulting date.