The following assumptions may be used in estimating a difference:
There are 365 days in a year.
There are 30 days in a month.
There are 24 hours in a day.
There are 60 minutes in an hour.
There are 60 seconds in a minute.
These assumptions are used when converting the information in the second argument, which is a timestamp duration, to the interval type specified in the first argument. The returned estimate may vary by a number of days. For example, if the number of days (interval 16) is requested for the difference between '1997-03-01-00.00.00' and '1997-02-01-00.00.00', the result is 30. This is because the difference between the timestamps is 1 month, and the assumption of 30 days in a month applies.
Visit the new-look IDUG Website , register to gain access to the excellent content.
That's right, TIMESTAMPDIFF is an approximation. However, whether you can use it or not depends on the actual requirements. In some cases that approximation may work; if you really need the underlying OS time value then you can't rely on DB2 in any case - you've got to go all the way to the OS to get your number of seconds, e.g. by writing a UDF that does a system call...