# periods()

Read（378）

Description:

Generate a sequence of datetime values by specified regular intervals.

Syntax:

periods(s,e,i)

Note:

The function generates a new sequence composed of datetimes in a period from s to e inclusive at a regular interval of i.

Parameters:

 s A datetime variable e A datetime variable i An integer indicating the interval; its unit is day and its value is 1 by default

Options:

 @y i is the year @q i is the quarter @m i is the month @t i is measured by ten days @s i is the second @x Exclusive of the ending point @o Do not adjust the first datetime value to the beginning point of the time unit. By default, it will be adjusted, and the adjustment is mandatory in the case of using @t.

Return value:

A new sequence composed of datetimes

Example:

 A 1 2000-08-10 12:00:00 2 =periods@y(A1,now(),1) Set year as the interval unit 3 =periods@yo(A1,now(),1) Do not adjust the first datetime; it is adjusted to the beginning point of the time unit by default, and must be adjusted when using @t. 4 =periods@q(A1,now(),1) Set quarter as the interval unit 5 =periods@m(A1,now(),1) Set month as the interval unit 6 =periods@s(A1,now(),7) Set second as the interval unit 7 =now() 8 =pdate@m(A7) Get the beggining date of the current month 9 =pdate@me(A7) Get the ending date of the current month 10 =elapse(A8,6-day@w(A8)) Get the first Friday 11 =periods@x(A10,A9,7) Get the sequence of Fridays 12 =A11(2) Get the second Friday 13 =A11.m(-1) Get the last Friday 14 =A11.len() Get the number of Fridays