DB2 graphic  QMF Version 8

Accounting for months with different numbers of days

Because of inconsistencies in the number of days in the months of the year, adding a month to a given date does not always result in the same day of the next month. The result of adding one month to January 31 cannot be February 31. Adding a month to a given date results in the same day of the next month when such a day exists. If it does not exist, adding a month to a given date results in the last day of the next month. For example, if you add one month to January 31, the result is February 28 (or February 29 in a leap year).

Use days to avoid inconsistencies in date arithmetic caused by months. For example, to increment a date by the difference between two dates, you can use an SQL statement like this:

SELECT DATE(DAYS('1988-01-05') + DAYS(ENDD) - DAYS(STARTD))
  FROM Q.PROJECT
  WHERE PROJNO = '1408'

QMF produces this report:

   COL1
   ----------
   1989-07-25


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