Hi there,
I have a requirement to get the date of All Saturdays and Sundays in a year,
please let me know if there is a way to do it.
Discussion posts and replies are publicly visible
a!forEach( items: enumerate(if(isleapyear(year(today())), 366, 365)), expression: if( contains( { 1, 7 }, weekday( date(year(today()), 1, 1) + (day() * fv!item) ) ), date(year(today()), 1, 1) + (day() * fv!item), {} ) )
In order to fetch Saturday and Sunday, i believe it should be {1,2}, instead of {1,7}
a!forEach( items: enumerate(if(isleapyear(year(today())), 366, 365)), expression: if( contains( { 1, 2 }, weekday( date(year(today()), 1, 1) + (day() * fv!item) ) ), date(year(today()), 1, 1) + (day() * fv!item), {} ) )
weekday(date, return_type)
Returns the day of the week of the specified date or datetime.
Returns: Number (Integer)
date (Date): The date or datetime that the day of the week will be calculated from.
.return_type: '1' correlates 1 ... 7 with Sunday ... Saturday (this is the default). '2' correlates 1 ... 7 with Monday ... Sunday. '3' correlates 0 ... 6 with Monday ... Sunday.
Totally depends on the calendar you are using and which day you start your week with.