How to get dates and days of week:
For example previous week was started on 19th October 2020 and ended on 25th October 2020,
So how do we get all days and dates between 19th and 25th,
Basically how do we gets to know the days and dates of the week.
Thanks in advance!
Discussion posts and replies are publicly visible
Hi,
Not exactly sure of the requirement but would something like this work. Local Start and End dates would become rule inputs of course. But this will return a list of dates that you could then query/manipulate in any way you wanted.
a!localVariables( local!start: fn!date(2020, 10, 19), local!end: fn!date(2020, 10, 25), local!numberOfDays: tointeger((local!end - local!start) + 1), local!dateList: repeat(local!numberOfDays, local!start), a!forEach( items: local!dateList, expression: fv!item + (fv!index-1) ))
Thanks for the suggestion
Here your taking definate dates
But my requirement is to get week start and end dates dynamically
For example start and end date for future weeks
Sorry, still not sure of the requirement. What is the trigger for the system to do something? If you could provide a specification by example that might help. (Given [this context}, when [this event occurs], then the system [should do this])
This should get you started. Adapt the second line to your needs. To get the first day of the week for any given date you can use the weekday() function und subtract the returned value from the given date. Change the second parameter of weekday() to match your understanding of what the first day of week is.
a!forEach( items: today() + enumerate(5), expression: { day: fv!item, dow: weekday(fv!item) } )