DB2 graphic  QMF Version 8

Incrementing and decrementing timestamps by durations

The result of adding a duration to a timestamp or subtracting a duration from a timestamp is a timestamp. The following example increments a timestamp by a duration of 30 microseconds:

SELECT TIMESTAMP + 30 MICROSECONDS
  FROM Q.PROJECT
  WHERE PROJNO = '1409'

QMF produces this report:

   COL1
   --------------------------
   1996-03-13-09.12.57.149602

Suppose that you want to know what the timestamp will be for project 1409 if you add a duration of 2 years, 1 month, and 2 hours to the project's existing timestamp. Use the following SQL statement:

SELECT TIMESTAMP + 2 YEARS + 1 MONTH + 2 HOURS
  FROM Q.PROJECT
  WHERE PROJNO = '1409'

QMF produces this report:

   COL1
   --------------------------
   1998-04-13-11.12.57.149572


Go to the previous page Go to the next page

Downloads | Library | Support | Support Policy | Terms of use | Feedback
Copyright IBM Corporation 1982,2004 Copyright IBM Corporation 1982, 2004
timestamp Last updated: March, 2004