ILE COBOL Language Reference

+-------------------------------IBM Extension--------------------------------+


CONVERT-DATE-TIME

The CONVERT-DATE-TIME function takes an item of class alphanumeric, numeric, or date-time and returns a date-time item.

The function type is date-time.

The length of the returned value depends on the length allowed for the format of the date, time, or timestamp item specified in argument-2 through argument-4.

Format
 
>>-FUNCTION CONVERT-DATE-TIME----------------------------------->
 
>--(--argument-1--argument-2--+----------------------------+--)-><
                              '-argument-3--+------------+-'
                                            '-argument-4-'
 
 
argument-1
Can be:
argument-2
Specifies the category of the return value and must be one of the following keywords:

If argument-1 is a date, time, or timestamp item, CONVERT-DATE-TIME can only convert:

If argument-2 is TIMESTAMP, neither argument-3 nor argument-4 can be specified.

If argument-1 is a date-time item, a date-time move is done.

If argument-1 is a numeric integer, the returned date-time item will be right-justified and truncated, if it is longer than what is allowed by the date-time format specified in argument-3.

If argument-1 is anything else, the returned date-time item will be left-justified and truncated, if it is longer than what is allowed by the date-time format specified in argument-3.

argument-3
Specifies the format of a date or time item. It must be:

For a list of valid literals and the rules that this argument must follow, refer to the SPECIAL-NAMES FORMAT clause described in FORMAT Clause.

Argument-3 should represent a category that is referred to by argument-2.

If argument-3 is the keyword LOCALE, then the format of the date or time is based on a LOCALE. If argument-4 is not specified, the current locale is used, otherwise the locale associated with the mnemonic-name or the LOCALE OF special register is used.

If argument-3 is not specified, the format of the returned value is dependent on the SPECIAL-NAMES FORMAT clause. If no format has been defined in the SPECIAL-NAMES paragraph, *ISO format is used.

argument-4
Must be a mnemonic-name associated with a LOCALE, or the LOCALE OF special register.

Argument-4 must follow these rules:

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]