calculate week days between two dates

G

Guest

How do I build a query expression to calculate number of weekdays between two
dates?
 
G

Graham R Seach

Oops, sorry, I just realised you asked for weekdays.

'Number of weekdays between two dates, by Doug Steele MVP
SELECT DateDiff("d", dte1, dte2) - DateDiff("ww", dte1, dte2, 1) * 2 -
IIf(Weekday(dte2, 1) = 7, IIf(Weekday(dte1, 1) = 7, 0, 1), IIf(Weekday(dte1,
1) = 7, -1, 0)) As WeekdaysBetween2Dates
FROM tblMyTable

(watch out for newsreader word wrap)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top