DateTime
Represents an instant capturing the date, the time and the timezone identifier.
Created {@ DateTime} objects are frozen with Object.freeze()
in constructor and thus immutable.
Static Method Summary
Static Public Methods | ||
public static |
fromStandardDate(standardDate: global.Date, nanosecond: NumberOrInteger | undefined): DateTime Create a DateTime object from the given standard JavaScript |
Constructor Summary
Public Constructor | ||
public |
constructor(year: NumberOrInteger, month: NumberOrInteger, day: NumberOrInteger, hour: NumberOrInteger, minute: NumberOrInteger, second: NumberOrInteger, nanosecond: NumberOrInteger, timeZoneOffsetSeconds: NumberOrInteger, timeZoneId: string | null) |
Member Summary
Public Members | ||
public |
day: NumberOrInteger The day. |
|
public |
hour: NumberOrInteger The hour. |
|
public |
minute: NumberOrInteger The minute. |
|
public |
month: NumberOrInteger The month. |
|
public |
nanosecond: NumberOrInteger The nanosecond. |
|
public |
second: NumberOrInteger The second. |
|
public |
timeZoneId: string The time zone id. |
|
public |
timeZoneOffsetSeconds: NumberOrInteger The time zone offset in seconds. |
|
public |
year: NumberOrInteger The year. |
Method Summary
Public Methods | ||
public |
toStandardDate(): StandardDate Convert date to standard JavaScript |
Static Public Methods
public static fromStandardDate(standardDate: global.Date, nanosecond: NumberOrInteger | undefined): DateTime source
Create a DateTime object from the given standard JavaScript Date
and optional nanoseconds.
Params:
Name | Type | Attribute | Description |
standardDate | global.Date | The standard JavaScript date to convert. |
|
nanosecond | NumberOrInteger | undefined | The optional amount of nanoseconds. |
Public Constructors
public constructor(year: NumberOrInteger, month: NumberOrInteger, day: NumberOrInteger, hour: NumberOrInteger, minute: NumberOrInteger, second: NumberOrInteger, nanosecond: NumberOrInteger, timeZoneOffsetSeconds: NumberOrInteger, timeZoneId: string | null) source
Params:
Name | Type | Attribute | Description |
year | NumberOrInteger | The year for the new date-time. |
|
month | NumberOrInteger | The month for the new date-time. |
|
day | NumberOrInteger | The day for the new date-time. |
|
hour | NumberOrInteger | The hour for the new date-time. |
|
minute | NumberOrInteger | The minute for the new date-time. |
|
second | NumberOrInteger | The second for the new date-time. |
|
nanosecond | NumberOrInteger | The nanosecond for the new date-time. |
|
timeZoneOffsetSeconds | NumberOrInteger | The time zone offset in seconds. Either this argument or |
|
timeZoneId | string | null | The time zone id for the new date-time. Either this argument or |
Public Members
public timeZoneOffsetSeconds: NumberOrInteger source
The time zone offset in seconds.
Either this or timeZoneId is defined.
Public Methods
public toStandardDate(): StandardDate source
Convert date to standard JavaScript Date
.
Return:
StandardDate | Standard JavaScript |
Throw:
Error |
If the time zone offset is not defined in the object. |