TIMESTAMP_ISO scalar function

The TIMESTAMP_ISO function returns a timestamp value that is based on a date, a time, or a timestamp argument.

Read syntax diagramSkip visual syntax diagramTIMESTAMP_ISO( expression)

The schema is SYSIBM.

If the argument is a date, TIMESTAMP_ISO inserts a value of zero for the time and the partial seconds parts of the timestamp. If the argument is a time, TIMESTAMP_ISO inserts the value of CURRENT DATE for the date part of the timestamp and a value of zero for the partial seconds part of the timestamp.

expression
An expression that returns a value of one of the following built-in data types:
  • a TIMESTAMP WITHOUT TIME ZONE
  • a date
  • a time
  • a character string
  • or a graphic string

If expression is a character or graphic string, it must not be a CLOB or DBCLOB and its value must be a valid string representation of a date, a time, or a timestamp. For the valid formats of string representations of dates, times, and timestamps, see String representations of datetime values.

Start of changeIf expression is a timestamp, the result of the function is timestamp without time zone, with the same precision as expression. Otherwise, the result of the function is a TIMESTAMP (6) WITHOUT TIME ZONE.End of change

The result can be null; if the argument is null, the result is the null value.

Notes

Syntax alternatives:
Use the CAST specification for maximum portability. For more information, see CAST specification.

Examples

Example 1:
Assume the following date value '1965-07-27'. The following statement returns the value '1965-07-27-00.00.00.000000'.
   SELECT TIMESTAMP_ISO( DATE( '1965-07-27' ) ) 
     FROM SYSIBM.SYSDUMMY1