Generate consecutive time points with the same interval

 

Example 1: Interval days

Generate a 31-day date sequence between 2020-03-01 and 2021-03-30 in the Excel file, and the result is shown in the following figure:

undefined

Write SPL script:


A

1

=periods("2020-03-01","2021-03-30",31)

2

=T("e:/work/book1.xlsx",A1)

 

A1 Generate a date sequence with an interval of 31 days between 2020-03-01 and 2021-03-30

 

A2 Save A1 to the file book1.xlsx

 

Example 2: Interval seconds

Generate a time series with an interval of 2 hours between 08:00 and 20:00 in the Excel file, and the results are shown in the following figure:

undefined

Write SPL script:


A

1

=periods@s("08:00:00","20:00:00",7200)

2

=T("e:/work/book1.xlsx",A1)

 

A1 Generate a time series with an interval of 2 hours between 08:00 and 20:00. The option @s means the interval time unit is seconds.

 

A2 Save A1 to the file book1.xlsx

 

Example 3: Interval months

Generate a date series with an interval of 1 month between 2018-03-31 and 2019-03-01 in the Excel file, and the result is shown in the following figure:

undefined

Write SPL script:


A

1

=periods@mox("2018-03-31","2019-03-01",1)

2

=T("e:/work/book1.xlsx",A1)

 

A1 Generate a date sequence with an interval of 1 month between 2018-03-31 and 2019-03-01, the option @m means the interval time unit is month, x means that the endpoint 2019-03-01 is not included, and o means that the time does not need to be adjusted to the starting point of the time. If this option is not added, it will be adjusted to the 1st of each month from the second time point.

 

A2 Save A1 to the file book1.xlsx

 

In addition, ten days, quarters, and years can be used as the interval time unit. You can refer to the help of the periods function.