%TIMESTAMP (Convert to Timestamp)
%TIMESTAMP{(char-num-expression { : *ISO|*ISO0 : {fractional-seconds}})}
%TIMESTAMP{(date-timestamp-expression { : fractional-seconds})}
If you do not specify a parameter, or if you specify *SYS as the first parameter, %TIMESTAMP returns the current system timestamp.
%TIMESTAMP converts the value of the expression from character, numeric, date or timestamp data to type timestamp. The converted value is returned as a timestamp.
The first parameter is the value to be converted. If you do not specify a value, %TIMESTAMP returns the current system timestamp. Only the first three digits of the fractional seconds portion of the timestamp will be set to a non-zero value. The remaining fractional seconds will be zero.
- If the first parameter is a character or numeric expression,
the second parameter is the timestamp format.
Regardless of the input format, the output is returned in *ISO format.
For character input, you can specify either *ISO (the default) or *ISO0. For more information, see Timestamp Data Type.
If the first parameter is numeric, you do not need to specify the second parameter. The only allowed value is *ISO (the default).
The optional third parameter is the number of fractional seconds in the timestamp.
- If the first parameter is *SYS or a date
or timestamp expression, the optional second parameter is the number
of fractional seconds in the returned timestamp.
If the first operand is a date, the system converts the date from its current format to *ISO format and adds a time of
00.00.00
and zero fractional seconds.
The number of fractional seconds can be between 0 and 12. It defaults to 6 fractional seconds.
For more information, see Information Operations or Built-in Functions.