Kbase P99161: How to add a time interval to a date?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  22/12/2004 |
|
Status: Unverified
GOAL:
How to add a time interval to a date?
GOAL:
How to add months to a date?
GOAL:
How to add years to a date?
GOAL:
How to add weeks to a date?
GOAL:
How to add days to a date?
GOAL:
How to add hours to a date?
GOAL:
How to add minutes to a date?
GOAL:
How to add seconds to a date?
GOAL:
How to add milliseconds to a date?
GOAL:
ADD-INTERVAL function
FACT(s) (Environment):
OpenEdge 10
FIX:
The ADD-INTERVAL function:
Adds a time interval to, or subtracts a time interval from: a DATE, DATETIME, or DATETIME-TZ value.
Example:
Expiry_date = add-interval (today, 6, "months").
Syntax:
ADD-INTERVAL(datetime, interval-amount, interval-unit)
interval-amount:
A signed integer (positive or negative) indicating the amount of time you want to add to or subtract from datetime value.
interval-unit:
A character constant, or a character expression that evaluates to one of the following time units: ?years?, ?months?, ?weeks?, ?days?, 'hours?, ?minutes?, ?seconds? or ?milliseconds?. These values are case insensitive and may be singular.
Notes:
If datetime is a DATE or DATETIME, the time value defaults to midnight and the time zone value defaults to the session's time zone, respectively.
To add or subtract months or years, this function converts the date to Gregorian before adding or subtracting the year or month value. If the result is an invalid date, the function decrements the day part of the date until a valid date is obtained.
For example:
Adding 1 month to January 30, 2003 yields February 28, 2003.
Adding 13 months to January 30, 2003 yields February 29, 2004 (2004 is a leap year).
Subtracting 1 month from December 31, 2003 yields November 30, 2003.