DTADD: Incrementing a Date or Date-Time Component

How to:

Reference:

Given a date in standard date or date-time format, DTADD returns a new date after adding the specified number of a supported component. The returned date format is the same as the input date format.


Top of page

x
Syntax: How to Increment a Date or Date-Time Component
DTADD(date, component, increment)

where:

date

Date or date-time

Is the date or date-time value to be incremented.

component

Keyword

Is the component to be incremented. Valid components (and acceptable values) are:

  • YEAR (1-9999)
  • QUARTER (1-4)
  • MONTH (1-12)
  • WEEK (1-53). This is affected by the WEEKFIRST setting.
  • DAY (of the Month, 1-31)
  • HOUR (0-23)
  • MINUTE (0-59)
  • SECOND (0-59)
increment

Integer

Is the value (positive or negative) to add to the component.



Example: incrementing the DAY Component of a Date

DTADD adds three days to the employee date of birth:

 DTADD(DATE_OF_BIRTH, DAY, 3)

For 1976/10/21, the result is 1976/10/24.


Top of page

x
Reference: Usage Notes for DTADD

iWay Software