-
Notifications
You must be signed in to change notification settings - Fork 18
ISO 8601:2004 formats
jpmckinney edited this page Feb 6, 2013
·
6 revisions
Dates should be in one of the following formats:
YYYY
YYYY-MM
YYYY-MM-DD
YYYY-MM-DDThhZ
YYYY-MM-DDThh:mmZ
YYYY-MM-DDThh:mm:ssZ
where:
-
Y
is a year digit -
M
is a month digit from01
to12
-
D
is a day digit from01
to31
-
h
is an hour digit, from00
to23
-
m
is a minute digit, from00
to59
-
s
is a minute digit, from00
to59
-
T
andZ
are the literal uppercase letters "T" and "Z"
To validate a "date and time of day" representation, the following regular expression is sufficient:
^[0-9]{4}((-[0-9]{2}){0,2}|(-[0-9]{2}){2}(T[0-9]{2}(:[0-9]{2}(:[0-9]{2})?)?Z)?)$