B8601TXw. Format

Adjusts a Coordinated Universal Time (UTC) value to the user local time. Then, writes the local time by using the ISO 8601 basic time notation hhmmss+|-hhmm.

Categories: Date and Time
ISO 8601
Alignment: Right
Supports: ISO 8601 Elements 5.3.3 and 5.3.4

Syntax

B8601TXw.

Syntax Description

w

specifies the width of the output field.

Default 14
Range 9–20

Details

UTC values specify a time based on the zero meridian in Greenwich, England. Using this format, SAS converts a time value to the UTC value and determines the user local time by using the TIMEZONE= system option. If the TIMEZONE= option is not set, then the user local time is based on the local time. The B8601TX format writes SAS datetime values by using the following ISO 8601 basic time notation:
  • hhmmss+|–hhmm
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.
When SAS reads a UTC time by using the B8601TZ informat, and the adjusted time is greater than 24 hours or less than 00 hours, SAS adjusts the value so that the time is between 000000 and 240000. If the B8601TX format attempts to format a time outside of this time range, the time is formatted with asterisks to indicate that the value is out of range.

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='12:34:56't;
put t b8601tx.; 
run;
   073456-0500
options timezone='America/Adak';
data _null_ ; 
t='12:34:56't;
put t b8601tx.; 
run;
  023456-1000