Date
An ISO 8601 compliant date type.
Syntax
The date literal consists of the following values, separated by a -:
-
either a four-digit year or a sign with any number of digits for the year (e.g.
+252525meaning year 252525), -
a two-digit month of the year,
-
and a two-digit day of that month.
Example date literals
2024-03-30
1920-09-21
#!test[read]
#{{
match
let $x = 2024-03-30;
let $y = 1920-09-21;
#}}
Example date literals (non-4-digit year)
+20000-01-01
+900-09-21
#!test[read]
#{{
match
let $x = +20000-01-01;
let $y = +900-09-21;
#}}
|
The minimum supported date is January 1, 262144 BCE, and the maximum supported date is December 31, 262142 CE. |
In expressions
A difference between two dates values is a calendar duration between the two, in years, months, and days.
2024-03-30 - 2020-09-21 == P3Y6M9D
Insert data that has a date attribute
#!test[schema]
#{{
define
entity article, owns publish-date;
#}}
#!test[write]
insert
$a isa article, has publish-date 2025-01-10;
Specify valid values for a date attribute type
#!test[schema]
define
attribute quarter-start value date @values(2025-01-01, 2025-04-01, 2025-07-01, 2025-10-01);
Specify valid values for owning a date attribute type
#!test[schema]
define
entity half-year-report owns quarter-start @values(2025-01-01, 2025-07-01);
Specify range of valid values for a date attribute type
#!test[schema]
define
attribute contract-date value date @range(2020-01-01..2030-12-31);