NOW

The NOW function returns a timestamp based on a reading of the time-of-day clock when the SQL statement is executed at the current server.

Read syntax diagramSkip visual syntax diagramNOW (6integer)
Start of change
integer

Specifies the precision of the timestamp. Valid values are 0 to 12, inclusive. If a value is not specified, the default precision of 6 is used.

End of change

The value returned by the NOW function is the same as the value returned by the CURRENT_TIMESTAMP special register. If this function is used more than once within a single SQL statement, or used with the CURDATE or CURTIME scalar functions or the CURRENT_DATE, CURRENT_TIME, or CURRENT_TIMESTAMP special registers within a single statement, all values are based on a single clock reading.

The data type of the result is a timestamp Start of changewith a precision specified by integerEnd of change. The result cannot be null.

Note

Syntax alternatives: The CURRENT_TIMESTAMP special register should be used for maximal portability. For more information, see Special registers.

Example

  • Return the current timestamp based on the time-of-day clock.
      SELECT NOW()
        FROM SYSIBM.SYSDUMMY1