Using QMF

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                                                   |
+--------------------------------------------------------------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]