Jun 12, 2008 #1 Roni1 Programmer Dec 4, 2001 36 US How can I count how many DayOfWeek in [1,7] for a date range? Example: How mayy Saturdays and Sundays from 1/1/08 tru 6/30/08?
How can I count how many DayOfWeek in [1,7] for a date range? Example: How mayy Saturdays and Sundays from 1/1/08 tru 6/30/08?
Jun 13, 2008 #2 CR85user Technical User Jan 18, 2005 522 GB //Countwends if dayofweek({date.field}) in [1,7] then 1 else 0 Sum on this through a running total or summary as appropriate to your needs (Read totals FAQ if unsure) 'J Upvote 0 Downvote
//Countwends if dayofweek({date.field}) in [1,7] then 1 else 0 Sum on this through a running total or summary as appropriate to your needs (Read totals FAQ if unsure) 'J
Jun 13, 2008 1 #3 lbass Technical User Feb 9, 2002 32,816 US This seems to work: datevar start := {?start}; datevar end := {?end}; numbervar sats; numbervar suns; sats := datepart("ww",end,crSaturday)-datepart("ww",start,crSaturday); suns := datepart("ww",end,crSunday)-datepart("ww",start,crSunday); if dayofweek(start,CrSaturday) = 1 then sats := sats +1 ; if dayofweek(start, crSunday) = 1 then suns := suns + 1; "Sats: "+totext(sats,0,"") + " Suns: "+totext(suns,0,"") -LB Upvote 0 Downvote
This seems to work: datevar start := {?start}; datevar end := {?end}; numbervar sats; numbervar suns; sats := datepart("ww",end,crSaturday)-datepart("ww",start,crSaturday); suns := datepart("ww",end,crSunday)-datepart("ww",start,crSunday); if dayofweek(start,CrSaturday) = 1 then sats := sats +1 ; if dayofweek(start, crSunday) = 1 then suns := suns + 1; "Sats: "+totext(sats,0,"") + " Suns: "+totext(suns,0,"") -LB
Jun 25, 2008 Thread starter #4 Roni1 Programmer Dec 4, 2001 36 US Thank you LB, that was right on the money! I am sorry that took too long for me to respond. Cheers! Roni Upvote 0 Downvote
Thank you LB, that was right on the money! I am sorry that took too long for me to respond. Cheers! Roni