B8601DXw. Format

Adjusts a Coordinated Universal Time (UTC) datetime value to the user local date and time. Then, writes the local date and time by using the ISO 8601 datetime and time zone basic notation yyyymmddThhmmss+hhmm.

Categories: Date and Time
ISO 8601
Alignment: Left
Supports: ISO 8601 Element 5.4.1, complete representation

Syntax

B8601DXw.

Syntax Description

w

specifies the width of the output field.

Default 26
Range 20–35

Details

UTC values specify a date and a time that are based on the zero meridian in Greenwich, England. Using this format, SAS converts a datetime value to the UTC value and determines the user local date and time by using the value of the TIMEZONE= system option. If the TIMEZONE= option is not set, then the user local date and time are based on the local date and time. The B8601DX format writes SAS datetime values by using the following ISO 8601 basic datetime notation:
  • yyyymmddThhmmss+hhmm
yyyy
is a four-digit year.
mm
is a two-digit month (zero padded) between 01 and 12.
dd
is a two-digit day of the month (zero padded) between 01 and 31.
hh
is a two-digit hour (zero padded) between 00 and 23.
mm
is a two-digit minute (zero padded) between 00 and 59.
ss
is a two-digit second (zero padded) between 00 and 59.
+|–hhmm
is an hour and minute signed offset from zero meridian time. The offset must be +|–hhmm (that is, + or – and four characters).
Use + for time zones east of the zero meridian, and use – for time zones west of the zero meridian. For example, +0200 indicates a two-hour time difference to the east of the zero meridian, and –0600 indicates a six-hour time difference to the west of the zero meridian.
Restriction: The shorter form +|–hh is not supported.

Example

The first example uses the local time to determine the time and the time zone offset. The second example changes the time zone to America/Adak, which is Hawaii-Aleutian Time.
Statement
Result
data _null_ ; 
t='01Feb2013T12:34:56'dt ;
put t b8601dx.; 
run;
      20130201T073456-0500
options timezone='America/Adak';
data _null_ ; 
t='01Feb2013T12:34:56'dt ;
put t b8601dx.; 
run;
      20130201T023456-1000