String
|
Interpretation
|
Comment
|
---|---|---|
YYYY-MM-DDTHH:MM:SS
|
A specific date and
time
|
YYYY: Four-digit year.
MM: # of month (01-12).
DD: # of day of month
(01-31).
T: What follows is a
time in a 24-hour clock.
HH: Hours.
MM: Minutes.
SS: Seconds.
|
String
|
Interpretation
|
Comment
|
---|---|---|
2009-03-25
|
March 25, 2009
|
Year must have four
digits.
Month, day, hour, minute,
and second each must have two digits. Single-digit values must be
preceded by a leading zero.
|
2009-03-25T22:29:30
|
March 25, 2009 10:29
and 30 seconds p.m.
|
T is always required
before a time.
Times must always be
in military time (for example, 24-hour clock).
Midnight must be written
as 00:00. 24:00 is not valid.
The individual parts
of a date value must be separated by a hyphen (-).
The individual parts
of a time value must be separated by a colon (:).
|
2009-03-25T22:29:30.333+05:00
|
March 25, 2009 10:29
and 30.333 seconds p.m. in the time zone GMT + 5 hours
|
If provided, the time
zone must be in HH:MM format. It cannot be truncated or a partial
value.
Some values in ISO 8601
formats can have decimal places. Most commonly, this is seen in seconds.
The decimal place can be denoted as either a period (.) or a comma
(,).
When a time zone is
provided, it must be accompanied by a complete date. The date cannot
be truncated or a partial value. This is necessary because the 24
global time zones force the date to be considered as part of the time.
|
2009-03-25T22:29Z
|
March 25, 2009 10:29
p.m. Zulu time
|
Z can be used to substitute
for times in GMT (or Zulu) time.
|
String
|
Interpretation
|
Comment
|
---|---|---|
-----T22:29
|
The time 10:29 p.m.
No value for the date
is provided.
|
A time value must always
be prefixed by a date value.
In this example, the
date value is completely missing, which would be appropriate for time-only
fields.
|
2009
|
Year 2009.
|
Trailing values can
be truncated when the values are missing.
|
2009---25
|
The 25th day of an unknown
month in the year 2009.
The month is missing.
|
If a missing value is
embedded in the string, then it must always be denoted by a hyphen
(-).
|
--03-25
|
The 25th day of March
in an unknown year.
|
Missing year.
|
--03--T-:15
|
The 15th minute of an
unknown hour of an unknown day of the third month of an unknown year.
|
Missing year, day, and
hour.
|
2009-03
|
Month of March 2009.
|
Trailing partial values
can be omitted (truncated).
If time is omitted,
then T must also be omitted.
|
2009-03--T12
|
The 12th hour of an
unknown day in March 2009.
|
Missing day of month.
|
String
|
Interpretation
|
Comment
|
---|---|---|
PnYnMnDTnHnMnS
|
Duration
|
A span of time where
n is the number of the unit that follows the unit.
P: indicates that the
value is a duration (period)
nY: n elapsed years
nM: n elapsed months
nD: n elapsed days
T: the elapsed time
in hours, minutes, and seconds
nH: n elapsed hours
nM: n elapsed minutes
nS: n elapsed seconds
Typically, only the
units with actual values are given. For example, P0Y1M would be P1M.
|
String
|
Interpretation
|
Comment
|
---|---|---|
P1D
|
The span of one day.
|
Durations always start
with P for a period of time.
Units of time that are
not known are usually omitted. If time is omitted, then T must also
be omitted.
|
P0000-00-01
|
The span of zero years
+ zero months + one day.
|
Durations can be expressed
in an alternative format.
When expressed, the
length of time is stored in the same format as date and time, but
preceded by a P. Instead of expressing a specific point in time, it
expresses a period of time.
|
P1Y2M3DT4H5M6S
|
The span of 1 year,
2 months, 3 days, 4 hours, 5 minutes, and 6 seconds.
|
The units must be in
the correct order.
The T is required for
all time values, but it should not be specified if no time value is
given.
|
String
|
Interpretation
|
Comment
|
---|---|---|
PnYnMnDTnHnMnS/YYYY-MM-DDTHH:MM:SS
or
YYYY-MM-DDTHH:MM:SS/PnYnMnDTnHnMnS
or
YYYY-MM-DDTHH:MM:SS/PnYnMnDTnHnMnS
or
YYYY-MM-DDTHH:MM:SS/YYYY-MM-DDTHH:MM:SS
|
Intervals
|
This is a duration that
is anchored to a specific point in time.
|
String
|
Interpretation
|
Comment
|
---|---|---|
2009-03-25T22:29/P1Y
|
The span of one year
starting on March 25, 2009 at 10:29 p.m.
|
Intervals can express
the period of time that starts at a given point in time.
The end time is implied.
|
P0001-00-00/2009-03-25T22:29
|
The span of one year
ending on March 25, 2009 at 10:29 p.m.
|
Intervals can express
the period of time that ends at a given point in time.
The start time is implied.
|
2008-03-25/2009-03-25
|
The span of time between
March 25, 2008 and March 25, 2009, which happens to be one year.
|
Intervals can express
the period of time that starts at a given point in time and ends at
a given point in time.
The duration value itself
is implied.
|
Topic
|
Link
|
---|---|
SAS 9.3 Language Reference:
Concepts
|
|
Working with Dates and
Times Using the ISO 8601 Basic and Extended Notations
|
|
CALL IS8601_CONVERT
Routine
|
|
$N8601Bw.d Informat
|
|
$N8601Ew.d Informat
|
|
Reading Dates and Times
Using the ISO 860 Basic and Extended Notations
|