Jump to content

All the Sundays in a year


This topic is 1830 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Start by calculating the date of the first Sunday in the given year. Then loop, creating a record for each Sunday and adding 7 days, until you reach the following year:

Set Variable [ $sunday; Value:Let (
   nY = Date ( 1 ; 1 ; Get (ScriptParameter ) ) 
   ;
   nY + Mod ( 1 - DayOfWeek ( nY ) ; 7 )
)]
Loop
   New Record/Request
   Set Field [ YourTable::Datefield; $sunday ]
   Set Variable [ $sunday; Value:$sunday + 7 ]
   Exit Loop If [ Year ( $sunday ) > Get ( ScriptParameter ) ]
End Loop
Commit Records/Requests

where the given year is passed as the script parameter.

Link to comment
Share on other sites

This topic is 1830 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.