X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V < 1 2  (Go to first unread post)
   Reply to this topicStart new topic
> Calculating Work Days And Public Holidays    
post Nov 19 2013, 12:03 PM

Posts: 1
Joined: 19-November 13

Hi, I know this is an old thread, but I've been using this code to calculate work days and exclude holidays. What I've noticed is that any month where the working days should be 23, always returns 22. For example this year months July and October, which then gives incorrect results for the last 2 quarters. The field "WorkDays" does cover holidays, which is why I need "WDaysExHols" to work.
romDate ToDate WorkDays WDaysExHols
01/01/2013 31/03/2013 64 64
01/04/2013 30/06/2013 65 65
01/07/2013 30/09/2013 66 65
01/10/2013 31/12/2013 66 65
Any Help appreciated.
Go to the top of the page
post Nov 19 2013, 12:08 PM

UtterAccess VIP
Posts: 4,073
Joined: 19-October 10

Do the other months calculate correctly or incorrectly?
Go to the top of the page
post Nov 20 2013, 03:56 AM

UtterAccess VIP
Posts: 2,176
Joined: 21-February 07
From: Copenhagen

First, you should the corrected version from 2011 (see previous page) and its helper functions.
econd, note that the function works similar to DateDiff which means that if the same date is used for start and end, the count will be zero.
So, as you use ultimo for the end date, you miss one day. Thus, you date intervals should be:
FromDate ToDate WorkDays WDaysExHols
01/01/2013 01/04/2013 64 64
01/04/2013 01/07/2013 65 65
01/07/2013 01/10/2013 66 65
01/10/2013 01/01/2014 66 65
That will return the WordDays as listed.
Go to the top of the page
post Apr 7 2019, 05:41 AM

Posts: 1
Joined: 6-April 19

you are super sir your function saved my lot of time thank you very much
Go to the top of the page
post Oct 22 2019, 10:32 AM

Posts: 1
Joined: 22-October 19

Old post, but absolute legend. Worked a treat. notworthy.gif
Go to the top of the page
2 Pages V < 1 2

Custom Search

RSSSearch   Top   Lo-Fi    28th February 2020 - 10:41 PM