MicroStrategy ONE

AddMonths

AddMonths is used to calculate dates that occur N months before or after a given date. It returns this information in the form of a date or timestamp.

If the new date does not occur in the new month, the last date of the new month is returned.

Syntax

AddMonths(Date/Time,Offset)

Where:

  • Date/Time is the input date or timestamp.
  • Offset is an integer number of months to add.

For information on whether your database supports various date and time functions, see MicroStrategy and Database Support for Functions.

Example

AddMonths('2004-07-29', 3) = 2004-10-29

AddMonths('2004-07-29 10:00:00', 3) = 2004-10-29 10:00:00

AddMonths('2003-03-31', -1) = 2003-02-28