%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 format is *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 1. %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