daterange()

Generates a list of dates with the specified interval between the start and end dates. It does not include the end date in the list to be returned.

Syntax

daterange(START_DATE, END_DATE, [INTERVAL{y|mon|w|d|h|m|s}])
Required Parameters
START_DATE
Expression that returns the start date. The function returns null if a value of any other type is received.
END_DATE
Expression that returns the end date. The function returns null if a value of any other type is received.
Optional Parameters
INTERVAL{y|mon|w|d|h|m|s}
Time interval in a unit of time such as y (year), mon (month), w (week), d (day), h (hour), m (minute), and s (second) (default: 1d).
Caution
To avoid system overload, if the result of the 'daterange()' function exceeds 100,000, it causes an exception to fail the query.

Usage

json "{}" 
| eval mark_days=
  daterange(
    date("20150901", "yyyyMMdd"),
    date("20150908", "yyyyMMdd")
  )
  => ["2015-09-01 00:00:00+0900","2015-09-02 00:00:00+0900","2015-09-03 00:00:00+0900","2015-09-04 00:00:00+0900","2015-09-05 00:00:00+0900","2015-09-06 00:00:00+0900","2015-09-07 00:00:00+0900"]

json "{}" 
| eval mark_days=
  daterange(
    date("20150901", "yyyyMMdd"),
    date("20150902", "yyyyMMdd"),
    "4h"
  )
  => ["2015-09-01 00:00:00+0900","2015-09-01 04:00:00+0900","2015-09-01 08:00:00+0900","2015-09-01 12:00:00+0900","2015-09-01 16:00:00+0900","2015-09-01 20:00:00+0900"]

json "{}" | eval mark_days=daterange("20150901", "20150908") => null