constructor¶
Creates a value for the current local date, time, and offset.
1 | |
Creates a new value from a JavaScript Date.
1 | |
Creates a value from milliseconds since the Unix epoch in the local offset.
1 | |
Creates a value from an ISO-like or locale-formatted string.
1 | |
Creates a new value from calendar components in the local offset of that date.
1 | |
Creates a new value from local calendar and time components.
1 | |
Parameters¶
Date val
A JavaScript Date object.
number year
The year (e.g., 2024).
number month
The month (1-12, where 1 is January).
number day
The day of the month (1-31).
number hour
The hour (0-23).
number minute optional
The minute (0-59).
number second optional
The second (0-59).
number millisecond optional
The millisecond (0-999).
Remarks¶
Components outside their range, such as February 30, throw an error instead of rolling over to the next month.
Examples¶
Convert a JavaScript date¶
1 | |
Create the first day of the year¶
1 | |