%TIMESTAMP (Convert to Timestamp)

%TIMESTAMP{(expression{:*ISO|*ISO0})}

%TIMESTAMP converts the value of the expression from character, numeric, or date 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. The last three digits of the microsecond portion of the current system timestamp will be 000.

The second parameter is the timestamp format for character input. Regardless of the input format, the output is returned in *ISO format. 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).

If the first parameter is a date, do not specify the second parameter. The system converts the date from its current format to *ISO format and adds 00.00.00.0000.

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

Figure 261. %TIMESTAMP Example
 *..1....+....2....+....3....+....4....+....5....+....6....+....7...+....
 /FREE

   string = '1960-09-29-12.34.56.000000';
   timest =  %timestamp(string);   
    // timest now contains z'1960-09-29-12.34.56.000000'
 /END-FREE


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