Timestamp Language-Independent Type for YAML™ Version 1.1

Working Draft 2005-01-18

Oren Ben-Kiki

Clark Evans

Brian Ingerson

This document may be freely copied provided it is not modified.

Status

This specification is a draft reflecting consensus reached by members of the yaml-core mailing list. Any questions regarding this draft should be raised on this list.


URI:

tag:yaml.org,2002:timestamp

Shorthand:

!!timestamp

Kind:

Scalar.

Canonical:

[0-9][0-9][0-9][0-9] # (year)
-[0-9][0-9] # (month)
-[0-9][0-9] # (day)
T[0-9][0-9] # (hour)
:[0-9][0-9] # (minute)
:[0-9][0-9] # (second)
(\.[0-9]*[1-9])? # (fraction)
Z # (time zone)

Regexp:

 [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] # (ymd)
|[0-9][0-9][0-9][0-9] # (year)
 -[0-9][0-9]? # (month)
 -[0-9][0-9]? # (day)
 ([Tt]|[ \t]+)[0-9][0-9]? # (hour)
 :[0-9][0-9] # (minute)
 :[0-9][0-9] # (second)
 (\.[0-9]*)? # (fraction)
 (([ \t]*)Z|[-+][0-9][0-9]?(:[0-9][0-9])?)? # (time zone)

Definition:

A point in time.

A timestamp value represents a single point in time. This can be serialized using a subset of the ISO8601 format and the formats proposed by the W3C note on datetime. In addition, a more relaxed format is also supported for enhanced readability, using white space separation.

If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part may be omitted altogether, resulting in a date format. In such a case, the time part is assumed to be 00:00:00Z (start of day, UTC).

Example 1. !!timestamp Examples

canonical:        2001-12-15T02:59:43.1Z
valid iso8601:    2001-12-14t21:59:43.10-05:00
space separated:  2001-12-14 21:59:43.10 -5
no time zone (Z): 2001-12-15 2:59:43.10
date (00:00:00Z): 2002-12-14