%TIME (Convert to Time)

%TIME{(expression{:time-format})}

%TIME converts the value of the expression from character, numeric, or timestamp data to type time. The converted value remains unchanged, but is returned as a time.

The first parameter is the value to be converted. If you do not specify a value, %TIME returns the current system time.

The second parameter is the time format for numeric or character input. Regardless of the input format, the output is returned in *ISO format.

For information on the input formats that can be used, see Time Data Type. If the time format is not specified for numeric or character input, the default value is either the format specified on the TIMFMT control-specification keyword or *ISO. For more information, see TIMFMT(fmt{separator}).

If the first parameter is a timestamp, do not specify the second parameter. The system knows the format of the input in this case.

For more information, see Information Operations or Built-in Functions.

Figure 260. %TIME Example
 *..1....+....2....+....3....+....4....+....5....+....6....+....7...+....
 /FREE

    string = '12:34 PM';
    time =  %time(string:*USA);
    // time = t'12.34.00'
 /END-FREE


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