+-------------------------------IBM Extension--------------------------------+
The EXTRACT-DATE-TIME function returns part of a date, time, or timestamp item.
The function type is integer or alphanumeric. If argument-2 is a keyword (such as MONTHS or DAYS), or consists of only numeric specifiers, an integer is returned. Otherwise, an alphanumeric data item is returned.
The length of the result depends on the values extracted from the date-time item.
Format >>-FUNCTION EXTRACT-DATE-TIME--(--argument-1--argument-2--)----><
Argument-2 is a keyword that represents a duration or a non-numeric literal that contains one or more separators and conversion specifications.
If the non-numeric literal contains only numeric conversion specifiers, the value returned by the EXTRACT-DATE-TIME function is an integer. A non-numeric literal containing separators or alphanumeric conversion specifiers will result in an alphanumeric return value.
If argument-2 is a keyword, an integer is returned.
The valid durations and their equivalent conversion specifications are:
For a list of other valid conversion specifications see Table 5 in the description of the FORMAT clause of the SPECIAL-NAMES paragraph.
The duration keyword or conversion specifier used must be consistent with argument-1. For example, the duration keywords must obey the following rules:
If argument-1 is not a locale-based data item, then the locale-based conversion specifier (%p, in this case) is treated as a non-locale-based conversion specifier and the % is replaced with an @. Using our example, this means that %p would become @p, where @p is the non-locale-based equivalent of %p.
Related Information
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.