# Date

An [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) compliant date type.

## [](#_syntax)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. `+252525` meaning year 252525),
    
*   a two-digit month of the year,
    
*   and a two-digit day of that month.
    

Example date literals

```typeql
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)

```typeql
+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)In expressions

A difference between two dates values is a calendar duration between the two, in years, months, and days.

```typeql
2024-03-30 - 2020-09-21 == P3Y6M9D
```

## [](#_defining_a_date_valued_attribute)Defining a date valued attribute

```typeql
#!test[schema]
define
  attribute publish-date value date;
```

## [](#_inserting_a_date_valued_attribute)Inserting a date valued attribute

```typeql
#!test[write]
insert
  $_ isa publish-date 2025-01-10;
```

[String](../string/index.md) [Datetime](../datetime/index.md)

[Edit on GitHub](https://github.com/typedb/typedb-docs/edit/3.x-development/typeql-reference/modules/ROOT/pages/values/date.adoc) Edit this page on GitHub.