dbTalk Databases Forums  

Workdays Between Two Dates

comp.databases.ms-access comp.databases.ms-access


Discuss Workdays Between Two Dates in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jeromez
 
Posts: n/a

Default Workdays Between Two Dates - 12-17-2009 , 01:15 PM






I have two dates:


StartDate = 11/09/2009

ReportDate = 11/30/2009

I know that days elapsed is simply:

[ReportDate] - [StartDate] = 21 Days

But how do I get just WORKDAYS?

The result would be 16 days in this example.


I've searched previous posts and nothing really came up except some
macros which didn't work for me.

Thanks

Reply With Quote
  #2  
Old   
Bob Quintal
 
Posts: n/a

Default Re: Workdays Between Two Dates - 12-17-2009 , 04:31 PM






jeromez <jeromezilincik (AT) gmail (DOT) com> wrote in news:5782c8c6-240d-4e52-
8f3b-36ce1d2ea0a1 (AT) 26g2000yqo (D...oglegroups.com:

Quote:
I have two dates:


StartDate = 11/09/2009

ReportDate = 11/30/2009

I know that days elapsed is simply:

[ReportDate] - [StartDate] = 21 Days

But how do I get just WORKDAYS?

The result would be 16 days in this example.


I've searched previous posts and nothing really came up except some
macros which didn't work for me.

Thanks

Dorman Blackman posted this 11 years ago.

Function BusinessDays(dDate1, dDate2) As Long
BusinessDays = (DateDiff("d", dDate1, dDate2) - _
(DateDiff("ww", dDate1, dDate2) * 2) + 1)
+ _
(WeekDay(dDate1) = vbSunday) + _
(WeekDay(dDate2) = vbSaturday)
End Function


--
Bob Quintal

PA is y I've altered my email address.

Reply With Quote
  #3  
Old   
jeromez
 
Posts: n/a

Default Re: Workdays Between Two Dates - 12-19-2009 , 11:51 AM



On Dec 17, 5:31*pm, Bob Quintal <rquin... (AT) sPAmpatico (DOT) ca> wrote:
Quote:
jeromez <jeromezilin... (AT) gmail (DOT) com> wrote in news:5782c8c6-240d-4e52-
8f3b-36ce1d2ea... (AT) 26g2000yqo (DOT) googlegroups.com:





I have two dates:

StartDate = 11/09/2009

ReportDate = 11/30/2009

I know that days elapsed is simply:

[ReportDate] - [StartDate] = 21 Days

But how do I get just WORKDAYS?

The result would be 16 days in this example.

I've searched previous posts and nothing really came up except some
macros which didn't work for me.

Thanks

Dorman Blackman posted this 11 years ago.

Function BusinessDays(dDate1, dDate2) As Long
* *BusinessDays = (DateDiff("d", dDate1, dDate2) - _
* * * * * * * * * * * * * *(DateDiff("ww", dDate1, dDate2) * 2) + 1)
+ _
* * * * * * * * * * * * * *(WeekDay(dDate1) = vbSunday) + _
* * * * * * * * * * * * * *(WeekDay(dDate2) = vbSaturday)
End Function

--
Bob Quintal

PA is y I've altered my email address.
thanx
I better catch up :P

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.