Skip to main content
Question

count the number of Saturdays between two dates?

  • October 26, 2018
  • 0 replies
  • 60 views

Forum|alt.badge.img+6
I need to count the number of Saturdays between two dates. Any ideas?
This topic has been closed for replies.

QuickBaseJunkie
Forum|alt.badge.img+15
Dealing with dates can be tricky. Something along these lines should work:

var number WEEKDAYADD = If(DayOfWeek([Date Two])=6,1,0);

ToDays((FirstDayOfWeek([Date Two])-FirstDayOfWeek([Date One])))/7 + $WEEKDAYADD

Basically, I'm adjusting the dates to both start at the beginning of the week, so that I can calculate the number of whole weeks, between them (and thus the Saturdays). Since the calendar starts on Sunday the first week will always have a Saturday in it. To compensate for the last week I check the day that the date falls on and either add one or zero to the total weeks.

I haven't tested it for all scenarios.

-Sharon