specifies a number that represents the number of years, months, or days
indicates that the duration that follows is specified by the number of years, months, days, hours, minutes, and seconds
indicates that a time value follows. Any value with a time must begin with T.
Requirement | Time values that are read by the extended notation informats that begin with the characters E8601 must use an uppercase T. |
indicates that the duration is specified in weeks.
indicates that the time value is the time in Greenwich, England, or UTC time.
the + indicates the time zone offset to the east of Greenwich, England. The - indicates the time zone offset to the west of Greenwich, England.
specifies a four-digit year
as part of a date, specifies a two-digit month, 01–12
specifies a two-digit day, 01–1
specifies a two-digit hour, 00–24
as part of a time, specifies a two-digit minute, 00–59
specifies a two-digit second, 00–59
specifies an optional fraction of a second using the digits 0–9:
fff | use 1 - 3 digits for values read by the $N8601B informat and the $N8601E informat |
ffffff | use 1 - 6 digits for informat other than the $N8601B informat and the $N8601E informat |
indicates that a year value precedes this character in a duration
as part of a date, indicates that a month value precedes this character in a duration
indicates that a day value precedes this character in a duration
indicates that an hour value precedes this character in a duration
as part of a time, indicates that a minute value precedes this character in a duration
indicates that a seconds value precedes this character in a duration
Date | yyyymmdd |
Time | hhmmss<ffffff> |
Datetime | yyyymmddThhmmss<ffffff> |
Time with time zone | hhmmss<ffffff>+|–hhmm |
Datetime with time zone | yyyymmddThhmmss<ffffff>+|–hhmm |
Date, Time, or Datetime
|
ISO 6801 Notation
|
Example
|
Format
|
---|---|---|---|
Date
|
yyyymmdd
|
20120915
|
|
Writes the date from
a datetime.
|
yyyymmdd
|
20120915
|
|
Time
|
hhmmssffffff
|
155300322348
|
|
Zero meridian time and
time zone offset.
The time zone offset
is always +0000 or Z.
|
hhmmss+|–hhmm
|
155300+0000
|
|
|
hhmmssZ
|
155300Z
|
|
Zero meridian time that
uses a time zone offset for the local time.
|
hhmmss+|–hhmm
|
155300–0500
|
|
Converts time to a user
local time by using a time zone offset for the user local time.
|
hhmmss+|–hhmm
|
155300–0500
|
|
Datetime
|
yyyymmddThhmmssffffff
|
20120915T155300
|
|
Zero meridian datetime
and time zone offset.
The time zone offset
is always +0000 or Z.
|
yyyymmddThhmmss+|–hhmm
|
20120915T155300–0000
|
|
|
yyyymmddThhmmssZ
|
20120915T155300Z
|
|
Zero meridian datetime
that uses a time zone offset for the user local time.
|
yyyymmddThhmmss+|–hhmm
|
20120915T155300+0500
|
|
Converts a datetime
value to the user local time by using a time zone offset for the user
local time.
|
yyyymmddThhmmss+|–hhmm
|
20120915T155300+0500
|
Date | yyyy-mm-dd |
Time | hh:mm:ss<ffffff> |
Datetime | yyyy-mm-ddThh:mm:ss<ffffff> |
Time with time zone | hh:mm:ss<ffffff>+|–hh:mm or hh:mm:ss<ffffff>Z |
Datetime with time zone | yyyy-mm-ddThh:mm:ss<ffffff>+|–hh:mm or yyyy-mm-ddThh:mm:ss<ffffff>Z |
Date, Time, or Datetime
|
ISO 8601 Notation
|
Example
|
Format
|
---|---|---|---|
Date
|
yyyy-mm-dd
|
2012-09-15
|
|
Writes the date from
a datetime.
|
yyyy-mm-dd
|
2012-09-15
|
|
Time
|
hh:mm:ss.ffffff
|
15:53:00.322348
|
|
Zero meridian time and
time zone offset.
The time zone offset
is always +00:00.
|
hh:mm:ss.ffffff+|–hh:mm
|
15:53:00+00:00
|
|
Zero meridian time that
uses a local time zone offset.
|
hh:mm:ss.ffffff+|–hh:mm
|
15:53:00+05:00
|
|
Converts time to user
local time by using a local time zone offset.
|
hh:mm:ss+|–hh:mm
|
15:53:00+05:00
|
|
Datetime
|
yyyy-mm-ddThh:mm:ss.ffffff
|
2012-09-15T15:53:00
|
|
Zero meridian datetime
and time zone offset.
The time zone offset
is always +00:00.
|
yyyy-mm-ddThh:mm:ss.nnnnnn+|–hh:mm
|
2013-09-15T15:53:00+00:00
|
|
Zero meridian datetime
that uses a time zone offset for the user local time.
|
yyyy-mm-ddThh:mm:ss+|–hh:mm
|
2013-09-15T15:53:00–05:00
|
|
Converts a datetime
value to the user local time by using a time zone offset for the user
local time.
|
yyyy-mm-ddThh:mm:ss+|–hh:mm
|
2013-09-15T185300–0500
|
data _null_; d='15Sep2013:5:53:00'dt; tm='05:53:00't; put 'd=' d datetime.; put 'e8601dz=' d e8601dz.; put 'e8601lx=' d e8601lx.; put 'e8601dx=' d e8601dx.; put 'tm=' tm time.; put 'e8601tz=' tm e8601tz.; put 'e8601lz=' tm e8601lz.; put 'e8601tx=' tm e8601tx.; run;
d=15SEP13:05:53:00 e8601dz= 2013-09-15T05:53:00+00:00 e8601lx= 2013-09-15T05:53:00-05:00 e8601dx= 2013-09-15T00:53:00-05:00 tm= 5:53:00 e8601tz=05:53:00+00:00 e8601lz=05:53:00-05:00 e8601tx=00:53:00-05:00
d=15SEP13:05:53:00 e8601dz= 2013-09-15T05:53:00+00:00 e8601lx= 2013-09-15T05:53:00-07:00 e8601dx= 2013-09-14T22:53:00-07:00 tm= 5:53:00 e8601tz=05:53:00+00:00 e8601lz=05:53:00-05:00 e8601tx=21:53:00-08:00
data a; input var1 b8601da8. +1 var2 e8601da10.; put var1=b8601da. var2=e8601da.; datalines; 20120402 2012-04-08 ; run;
var1=20120402 var2=2012-04-08
data _null_; input @1 dt b8601dn.; put dt b8601dn.; datalines; 20130915T094322 run;
20130915
data _null_; x=input('12:34:56',e8601tm8.); put x=b8601tm8. x=e8601tm10.; run;
x=123456 x=12:34:56
data _null_; x=input('12:34:56-04:00',e8601tz14.); put x=e8601tz14.; put x=b8601tz.; run;
x=16:34:56+00:00 x=163456+0000
options timezone=pst; data _null_; x='12:34:56't; put x=e8601tx.; run;
04:34:56-08:00
data _null_; x=time(); put x=e8601lz.; run;
x=13:49:02-04:00
data _null_; input dtB :b8601dt15. dtE :e8601dt19.; put dtB=b8601dt. dtE=e8601dt.; datalines; 20120402T124022 2012-04-02T12:30:22 ; run;
dtB=20120402T124022 dtE=2012-04-02T12:30:22
data a; input dt1 b8601dj.; put dt1=b8601dt.; datalines; 20120402123245 ; run;
dt1=20120402T123245
data _null_; x=input('2012-08-01T12:34:56-04:00',e8601dz25.); put x=e8601dz25.; run;
x=2012-08-01T16:34:56+00:00
options timezone='europe/zurich'; data _null_; x=input('2012-08-01T12:34:56-04:00',e8601dz25.); put x=e8601dx25.; run;
x=2012-08-01T18:34:56+02:00
options timezone='america/anchorage'; data _null_; t='01Feb2013T12:34:56'dt; put t=e8601dx.; run;
2013-02-01T03:34:56-09:00
data _null_; x=time(); put x=e8601lz.; run;
x=13:49:02-04:00
options timezone=pst; data _null_; x='01Feb2013T12:34:56'dt; put x=e8601lx.; run;
2013-02-01T12:34:56-07:00
Time Component
|
ISO 8601 Notation
|
Example
|
Format
|
---|---|---|---|
Duration - Basic Notation
|
PyyyymmddThhmmssfff
|
P20120915T155300
|
$N8601BA
|
|
–PyyyymmddThhmmssfff
|
–P20120915T155300
|
$N8601BA
|
Duration - Extended
Notation
|
Pyyyy-mm-ddThh:mm:ss.fff
|
P2012-09-15T15:53:00
|
$N8601EA
|
|
–Pyyyy-mm-ddThh:mm:ss.fff
|
–P2012-09-15T15:53:00
|
$N8601EA
|
Duration - Basic and
Extended Notation
|
PnYnMnDTnHnMnS
|
P2y10m14dT20h13m45s
|
$N8601B
$N8601E
|
|
–PnYnMnDTnHnMnS
|
–P2y10m14dT20h13m45s
|
$N8601B
$N8601E
|
|
PnW
(weeks)
|
P6w
|
$N8601B
$N8601E
|
Interval - Basic Notation
|
yyyymmddThhmmssfff/yyyymmddThhmmssfff
|
20120915T155300/20141113T000000
|
$N8601BA
|
|
PnYnMnDTnHnMnS/yyyymmddThhmmssfff
|
P2y10M14dT20h13m45s/20120915T155300
|
$N8601B
|
|
yyyymmddThhmmssfff/PnYnMnDTnHnMnS
|
20120915T155300/P2y10M14dT20h13m45s
|
$N8601BA
|
Interval - Extended
Notation
|
yyyy-mm-ddThh:mm:ss.fff/yyyy-mm-ddThh:mm:ss.fff
|
2012-09-15T15:53:00/2014-11-13T00:00:00
|
$N8601EA
|
|
PnYnMnDTnHnMnS/yyyy-mm-ddThh:mm:ss.fff
|
P2y10M14dT20h13m45s/2012-09-15T15:53:00
|
$N8601E
|
|
yyyy-mm-ddThh:mm:ss.fff/PnYnMnDTnHnMnS
|
2012-09-15T15:53:00/P2y10M14dT20h13m45s
|
$N8601EA
|
Datetime - Basic Notation
|
yyyymmddThhmmss.fff+|–hhmm
|
20120915T155300
|
$N8601BA
|
|
(all blank)
|
|
$N8601B
$N8601BA
$N8601E
$N8601EA
|
Datetime - Extended
Notation
|
yyyy-mm-ddThh:mm:ss.fff+|–hhmm
|
2012-09-15T15:53:00
+04:30
|
$N8601EA
|
|
(all blank)
|
|
$N8601B
$N8601BA
$N8601E
$N8601EA
|
x
.
A single hyphen represents the entire value for a given component.
For example, one single hyphen can replace a four-digit year. A single
x represents one character for a given component. A missing two-digit
month would be written as xx
.
If the time portion is omitted when a date value is specified, the
T must also be omitted.
x
.
For example, in P2mT4H, the year, day, minutes, and seconds are missing
and have been dropped.
x
:
Format
|
Datetime Form
|
Duration Form
|
Example
|
---|---|---|---|
$N8601H
|
yyyy-mm-ddThh:mm:ss
|
PnYnMnDTnHnMnS
|
--09-15T15:-:53
P2Y2DT4H5M6S/--09-15T15:-:00
|
$N8601EH
|
yyyy-mm-ddThh:mm:ss
|
Pyyyy-mm-ddThh:mm:ss
|
P000---02T02:55:20/2012---15T-:-:45
|
$N8601X
|
yyyy-mm-ddThh:mm:ss
|
PnYnMnDTnHnMnS
|
P2Y2DT4H5M6S/xxxx-09-15T15:xx:00
|
$N8601EX
|
yyyy-mm-ddThh:mm:ss
|
Pyyyy-mm-ddThh:mm:ss
|
P0003-xx-02T02:55:20/2012-xx-15Txx:xx:45
|
x
.
p00030202T1031
2012-09-15T15/2014-09-15T15:53
–p0003-03-03T-:-:-
P2y3m4dT5h6m
2012-09-xxTxx:xx:xx
2012
Duration
|
Extended Normalized
Duration
|
---|---|
p3y13m |
p0004-01 |
pt24h24m65s |
P----01T-:25:05 |
p3y13mT24h61m |
P0004-01-01T01:01 |
p0004-13 |
p0005-01 |
p0003-02-61T15:61:61 |
P0003-04-01T16:02:01 |
p13m |
P13M |
pT12:60:13
becomes PT13:-:13
.