MicroStrategy ONE

AddDays

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

Syntax

AddDays(Date/Time,Offset)

Where:

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

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

Example

AddDays('2020-07-29', 4) = 2020-08-02

AddDays('2020-07-29 02:00:00', 4) = 2020-08-02 02:00:00

AddDays('2020-03-01', -4) = 2020-02-26

The following example can be used to change a TimeDate attribute or metric to a different time zone. Subtract four hours to change the time zone from GMT to EST. This does not account for daylight savings time.

AddDays(TimeDate, -4/24)