MicroStrategy ONE

DaysBetween

Returns the difference in days between two given dates as an integer value. The calculation of the difference is based on the number of day boundaries crossed, not the number of twenty-four hours periods elapsed. If the first date argument is later than the second date argument, the result is a negative number. The result does not display the time stamps, as they are truncated before performing the calculation.

Syntax

DaysBetween(Date/Time1, Date/Time2)

Where:

  • Date/Time1 is the start date.
  • Date/Time2 is the end date.

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

Examples

Inputs are the dates 2004-07-29 and 2004-07-25; output is the integer -4.

Inputs are the dates 2004-07-29 02:00:00 and 2004-07-31 01:00:00; output is the integer 2.