GetDates

This function evaluates to a list of datetimes; from a start datetime to an end datetime, with a given interval separating the dates.

Description

Generate a list of datetimes between two datetimes at a given interval.

Type

LIST {DATETIME}

Arguments

Type

Meaning

1

DATETIME

starting datetime

2

DATETIME

ending datetime

3

STRING

string representation of a datetime interval expressed as an integer, a space, and a time unit.

Evaluation

The starting datetime and ending datetime; which may be specified symbolically, are converted into actual datetimes. The string representation of the interval is resolved into a time length. Then, a list is created beginning with the starting datetime. The time length is added to each previous datetime in the list until the resulting datetime is later than the ending datetime.

Mathematical Expression

 

Comments

If the ending date is before the starting date, the function evaluates to an empty list. If the ending date is equal to the starting date, or if the time interval is larger than the interval between the starting and ending dates, the function evaluates to a list which only contains the start date.

The accepted datetime interval units are:

  • hours or Hour s
  • days or Days
  • weeks or Weeks
  • months or Months
  • years or Years
 
GetDates(@"January 20, 1996", @"January Max DayOfMonth, 1996",
"6 Hours"}
 
{@"24:00 January 20, 1996", @"06:00 January 21, 1996", @"12:00 January 21, 1996", ...}