DateTime DataType

The DateTime type represents dates and times in ISO 8601 format.

Definition

Type URL https://rustybeam.net/schema/DateTime
Base Type datetime
Default Pattern ^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d{3})?(?:Z|[+-]\d{2}:\d{2})?)?$
Constraints {"format": "ISO 8601"}

Accepted Formats

The validation pattern accepts ISO 8601 dates and datetimes:

Usage in Property Definitions

<tr itemscope itemtype="https://rustybeam.net/schema/Property">
    <td><span itemprop="name">createdAt</span></td>
    <td><span itemprop="type">DateTime</span></td>
    <td><span itemprop="cardinality">1</span></td>
    <td><span itemprop="description">When the record was created</span></td>
</tr>

Usage in Data

<time itemprop="createdAt" datetime="2024-07-18T14:30:00Z">July 18, 2024</time>

Note: When using DateTime in HTML, it's recommended to use the <time> element with the datetime attribute for machine-readable values.

See Also