Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date range excluding Satrudays & Sundays 1

Status
Not open for further replies.

routine

Programmer
Jul 8, 2010
2
0
0
ZA
I need to read a date range and then return the days
excluding Saturdays and Sundays
 
Hi!

CASE (<ChosenDate> % 7)
OF 0 ! Sunday
OF 6 ! Saturday
ELSE
! do what you want
END

As a Filter ::

<ChosenDate> >= <FromDate> AND |
<ChosenDate> <= <ToDate> AND |
INRANGE((<ChosenDate> % 7),1,5)

This will work for an ISAM database like Topspeed but you may need something different for SQL databases.

Regards
 
What is the <ChosenDate> the routine refers to?
 
Hi!

The Date Variable/Column you are comparing from the Date Range i.e.

Code:
LOOP Date# = DATE(1,1,2010) to DATE(12,31,2010)
  CASE (Date# % 7)
  OF 0 ! Sunday
    Sundays# += 1
  OF 6 ! Saturday
    Saturdays# += 1
  ELSE
    IF <PublicHoliday> ! use your own method to find out if it is a public holiday
       PublicHolidays# += 1
    END   
  END
END

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top