-
Notifications
You must be signed in to change notification settings - Fork 0
API Date
Date and time value with component accessors and formatting.
Date wraps a .NET date/time value. A date is created from a tick count or from a supported formatted date string, and all component properties are read-only.
String parsing is culture-independent. The host Runtime.DateTimeFormat is tried first when it is configured, followed by the built-in invariant formats:
yyyy-MM-ddyyyy-MM-dd HH:mm:ssyyyy-MM-dd HH:mm:ss.fffyyyy-MM-dd HH:mm:ss fffyyyy-MM-ddTHH:mm:ss.fff
Note
The constructor does not read the system clock. Use Date.now() for the current local time or Date.utcNow() for the current UTC time.
| Member | Returns | Summary |
|---|---|---|
new Date(value) |
date |
Creates a date from ticks or a supported date string. |
Date.now() |
date |
Current local timestamp. |
Date.utcNow() |
date |
Current UTC timestamp. |
Date.parse(value) |
date |
Parses a date/time string or tick value. |
date.year |
number |
Year component. |
date.month |
number |
Month component, 1 through 12. |
date.day |
number |
Day-of-month component. |
date.hour |
number |
Hour component. |
date.minute |
number |
Minute component. |
date.second |
number |
Second component. |
date.millisecond |
number |
Millisecond component. |
date.dayOfWeek |
number |
Day-of-week component. |
date.dayOfYear |
number |
Day-of-year component. |
date.ticks |
number |
Underlying tick value. |
date.toString([format]) |
string |
Formats the date as text. |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value |
number or string
|
Yes | Tick count, or date text in a supported format. |
Returns
date — the parsed date value.
Behavior
The host Runtime.DateTimeFormat is tried first, then the built-in invariant formats listed in the overview.
Example
var date = new Date("2026-08-19");
return date.year; // 2026All Date component properties are read-only numbers.
| Property | Type | Description |
|---|---|---|
date.year |
number |
Year component. |
date.month |
number |
Month component, 1 through 12. |
date.day |
number |
Day-of-month component. |
date.hour |
number |
Hour component. |
date.minute |
number |
Minute component. |
date.second |
number |
Second component. |
date.millisecond |
number |
Millisecond component. |
date.dayOfWeek |
number |
Day-of-week component, as its enumeration number. |
date.dayOfYear |
number |
Day-of-year component. |
date.ticks |
number |
Underlying tick value. |
Example
var date = new Date("2026-08-19 10:30:45.123");
return date.year + ":" + date.month + ":" + date.day + ":" + date.millisecond; // 2026:8:19:123Parameters
None.
Returns
date — the current local timestamp.
Example
return Date.now().year;Parameters
None.
Returns
date — the current UTC timestamp.
Example
return Date.utcNow().year;Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value |
string or number
|
Yes | Date text in a supported format, or a tick count. |
Returns
date — the parsed date value.
Behavior
The host Runtime.DateTimeFormat is tried first, then the built-in invariant formats.
Warning
Text outside the supported formats is not reliable input. Normalize incoming date strings before parsing them.
Example
return Date.parse("2026-08-19 10:30:00").hour; // 10var precise = Date.parse("1991-02-01 12:32:55 666");
return precise.millisecond; // 666Parameters
| Name | Type | Required | Description |
|---|---|---|---|
format |
string |
No | .NET date-format string. Omitting it uses the host Runtime.DateTimeFormat. |
Returns
string — the formatted date text.
Example
var date = new Date("2026-08-19");
return date.toString("yyyy/MM/dd"); // "2026/08/19"AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License