$N8601Xw.d Format

Writes ISO 8601 duration, datetime, and interval forms PnYnMnDTnHnMnS and yyyy-mm-ddThh:mm:ss, dropping omitted components in duration values and using an x for each digit of an omitted component in datetime values.

Categories: Date and Time
ISO 8601
Alignment: Left
Restriction: UTC time zone offset values are not supported.
Supports: ISO 8601 Elements 5.5.3, 5.5.4.1, and 5.5.4.2

Syntax

$N8601Xw.d

Syntax Description

w

specifies the width of the output field.

Default 50
Range 1–200
Requirement The minimum length for a duration value or a datetime value is 16. The minimum length for an interval value is 16.

d

specifies the number of digits to the right of the lowest-order component. This argument is optional.

Default 0
Range 0–3

Details

The $N8601X format writes ISO 8601 durations, intervals, and datetimes in the following forms, omitting components in the PnYnMnDTnHnMnS form and using an x to represent omitted components in the datetime form:
  • PnYnMnDTnHnMnS
  • yyyy-mm-ddThh:mm:ss
  • PnYnMnDTnHnMnS/yyyy-mm-ddThh:mm:ss
  • yyyy-mm-ddThh:mm:ssT/PnYnMnDTnHnMnS
  • yyyy-mm-ddThh:mm:ss/yyyy-mm-ddThh:mm:ss
Omitted datetime components are always displayed; they are never truncated.

Example

put nx $n8601x.;
Value of nx
Result
0002304FFFFFFFFC2011FFF15FFFFFFD
P2Y3M4D/2011-xx-xxT15:xx:xx
FFFF102FFFFFFFFD2011FFF15FFFFFFd
xxxx-01-02Txx:xx:xx/2011x-xxT15:xx:xx