16.8 The first Friday of a certain month/quarter/year

 

Script:

A
1 >n=5
2 =pdate@w(pdate@m(date(“2021-05-01”))+6-n)+n
3 =pdate@w(pdate@q(date(“2021-05-01”))+6-n)+n
4 =pdate@w(pdate@y(date(“2021-05-01”))+6-n)+n

A1: n represents the day of the week, and Sunday is 0, followed by +1
A2: Use the pdate@m to find the first day of the month, then add 6-n days to this day, and find the Sunday of the week of the date, and finally add n days to obtain result: 2021-05-07
A3: Use the pdate@q to find the first day of the quarter, and then add 6-n days to this day, and find the Sunday of the week of the date, and finally add n days to obtain result: 2021-04-02
A4: Use the pdate@y to find the first day of the year, and then add 6-n days to this day, and find the Sunday of the week of the date, and finally add n days to obtain result: 2021-01-01


esProc Desktop and Excel Processing
16.7 Generate a time sequence with the same time interval - Sunday