Using QMF

Incrementing and decrementing dates by durations

Suppose that you want to know what the start date for project 1404 would be if you delayed it one year. You would increment the current start date (1991-01-04) by using a duration of 1 year. For example, when you run this SQL statement:

SELECT STARTD + 1 YEAR
  FROM Q.PROJECT
  WHERE PROJNO = '1404'

QMF produces this report:

+--------------------------------------------------------------------------------+
|   COL1                                                                         |
|   ----------                                                                   |
|   1998-01-04                                                                   |
+--------------------------------------------------------------------------------+

The month of the result is the same as the month of the date you are incrementing. The day of the result is the same as that of the date incremented, unless the result is February 29 of a year that is not a leap year. In that case, the day is February 28.

If you want to know what the end date of project 1404 (currently slated for 1993-06-30) would be if you finish the project two months ahead of schedule, run this SQL statement using the duration of 2 months:

SELECT ENDD - 2 MONTHS
  FROM Q.PROJECT
  WHERE PROJNO = '1404'

QMF produces this report:

+--------------------------------------------------------------------------------+
|   COL1                                                                         |
|   ----------                                                                   |
|   1999-04-30                                                                   |
+--------------------------------------------------------------------------------+

QMF counts only months (calendar pages) and years (if necessary). The day of the result is the same as the day of the date you are decrementing, unless the result would be an date that is not valid. In that case, the day part of the result is the last day of the month.

To find out what the start date of project 1407 would be if the project is started 30 days early, run the following SQL statement using the duration of 30 days:

SELECT STARTD - 30 DAYS
  FROM Q.PROJECT
  WHERE PROJNO = '1407'

QMF produces this report:

+--------------------------------------------------------------------------------+
|   COL1                                                                         |
|   ----------                                                                   |
|   1997-11-12                                                                   |
+--------------------------------------------------------------------------------+

Suppose that you want to know what the end date for project 1407 would be if you delay the project by 2 years and 11 months. For example, if you run this SQL statement:

SELECT ENDD + 2 YEARS + 11 MONTHS
  FROM Q.PROJECT
  WHERE PROJNO = '1407'

QMF produces this report:

+--------------------------------------------------------------------------------+
|   COL1                                                                         |
|   ----------                                                                   |
|   2003-05-15                                                                   |
+--------------------------------------------------------------------------------+

Suppose, rather than increment by the two years and eleven months duration used in the preceding example, you want to decrement by the same duration. You want to know the project end date if the project is finished 2 years and 11 months ahead of schedule. For example, if you run this SQL statement:

SELECT ENDD - 2 YEARS - 11 MONTHS
  FROM Q.PROJECT
  WHERE PROJNO = '1407'

QMF produces this report:

+--------------------------------------------------------------------------------+
|   COL1                                                                         |
|   ----------                                                                   |
|   1997-07-15                                                                   |
+--------------------------------------------------------------------------------+


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