HOURS_BETWEEN

Purpose

This function returns the number of hours between timestamp timestamp1 and timestamp timestamp2.

Syntax

hours_between::=

Hours Between

Usage Notes

  • If timestamp timestamp1 is earlier than timestamp timestamp2, then the result is negative.
  • For data type TIMESTAMP WITH LOCAL TIME ZONE this function is calculated internally within UTC.

Example

SELECT HOURS_BETWEEN(TIMESTAMP '2000-01-01 12:00:00',
                     TIMESTAMP '2000-01-01 11:01:05.1') HB;