Working with Dates
Date and time handling with timezone support, relative offsets, ranges, and recurrence patterns.
The Magic <now> Variable
ARO provides a special <now> variable that's always available without declaration.
It returns the current date and time in UTC:
(* Log the current time *)
<Log> <now> to the <console>.
Output: 2025-12-29T15:20:49Z
UTC by Default
All dates in ARO are UTC unless explicitly converted. This eliminates timezone bugs and ensures consistent behavior across systems.
Extracting Date Components
Extract individual parts of a date using qualifiers:
<Extract> the <year> from the <now: year>.
<Extract> the <month> from the <now: month>.
<Extract> the <day> from the <now: day>.
<Extract> the <hour> from the <now: hour>.
Available Properties
| Property | Description | Example |
|---|---|---|
year | Four-digit year | 2025 |
month | Month (1-12) | 12 |
day | Day of month (1-31) | 29 |
hour | Hour (0-23) | 15 |
minute | Minute (0-59) | 20 |
second | Second (0-59) | 49 |
dayOfWeek | Day of week (1=Sun, 7=Sat) | 1 |
timestamp | Unix timestamp | 1735485649 |
iso | ISO 8601 string | 2025-12-29T15:20:49Z |
Parsing Date Strings
Convert ISO 8601 strings into date objects:
<Compute> the <deadline: date> from "2025-12-31T23:59:59Z".
<Extract> the <deadline-year> from the <deadline: year>.
Formatting Dates
Format dates for display using pattern strings:
<Compute> the <display: format> from <now> with "MMMM dd, yyyy".
(* Result: "December 29, 2025" *)
<Compute> the <short: format> from <now> with "MMM dd".
(* Result: "Dec 29" *)
Format Patterns
| Pattern | Result |
|---|---|
yyyy-MM-dd | 2025-12-29 |
MMMM dd, yyyy | December 29, 2025 |
dd.MM.yyyy | 29.12.2025 |
HH:mm:ss | 15:20:49 |
Relative Offsets
Calculate dates relative to other dates:
<Compute> the <tomorrow: +1d> from <now>.
<Compute> the <yesterday: -1d> from <now>.
<Compute> the <next-week: +7d> from <now>.
<Compute> the <expires: +24h> from <created>.
Offset Units
| Unit | Description |
|---|---|
s | Seconds |
m | Minutes |
h | Hours |
d | Days |
w | Weeks |
M | Months |
y | Years |
Date Ranges
Create and work with date ranges:
<Create> the <vacation: date-range> from <start> to <end>.
<Extract> the <duration> from the <vacation: days>.
Date Comparisons
Compare dates in when clauses:
when <booking> before <deadline> {
<Log> "Booking accepted" to the <console>.
}
when <event> after <now> {
<Log> "Upcoming event" to the <console>.
}
Recurrence Patterns
Define recurring schedules:
<Create> the <weekly: recurrence> with "every monday".
<Extract> the <next> from the <weekly: next>.
Pattern Examples
every day- Daily occurrenceevery week- Weekly occurrenceevery 2 weeks- Bi-weeklyevery monday- Every Mondayevery second tuesday- 2nd Tuesday of each monthevery last friday- Last Friday of each month
Learn More
See the ARO-0041 proposal for the complete date/time specification.