CalcDaysBetween ( startDate ; endDate ; numDays ; $$HolidayList ; countWeekends ; returnNeg )
Rate this function: Average rating: 3.1 (21 votes) Discuss this Custom Function
Shan Younker, Shan Younker
none
Calculates number of days between dates, accounts for holidays and weekends
Sample Input:
| CalcDaysBetween ( 7/1/2009 , 7/9/2009, 0, $$Holidays, False, "" ) |
|
Sample Output:
|
Description:
Calculates the number of days between two dates. Will not count holidays or weekends if passed a variable with a list of holidays.
When you initially call the function, pass a start and end date. Use 0 for numDays - this gets incremented each time through the loop. Pass a pre-populated list of holidays from a variable. CountWeekends - pass 'true' if you want to count weekends and holidays in numDays, pass 'false' if you don't. For returnNeg, pass "" when calling the function, if the startDate is after the endDate then the function will return a negative number for numDays.
Note: these functions are not guaranteed
or supported by BrianDunning.com. Please contact the individual
developer with any questions or problems.
This is my Custom Function and I want to
edit it
Discuss:5 most recent comments | Show all 7 comments Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:
|
Newest Custom Functions:
| 1. |
indonesian_date(date) |
| |
(Mon, Feb 06, 7:14pm) |
| 2. |
phpArrayValue ( array ; key ; pos ) |
| |
(Fri, Jan 27, 1:49pm) |
| 3. |
solfm_timeToMinutes (theTime;roundSec) |
| |
(Fri, Jan 20, 6:26am) |
| 4. |
filterLines(filterField;filterValue;Result) |
| |
(Sat, Jan 14, 2:20pm) |
| 5. |
getMaxValue ( theList ) |
| |
(Thu, Jan 12, 1:06pm) |
| 6. |
MiddleWordsIncPunct ( text ; startingWord ; numberOfWords ) |
| |
(Sat, Jan 07, 9:16am) |
| 7. |
WindowInfo |
| |
(Fri, Jan 06, 12:39pm) |
| 8. |
CenterWindow in Window vert horiz (demension) |
| |
(Fri, Jan 06, 12:25pm) |
 |
|
Thank you for developing this custom function - I have found it to be very useful ...
But I need to report a bug!
When working with negative results, the 'ReturnNeg' variable is not consistently 'True'. I have tracked this down to a missing entry (shown in caps and quotes) in the formula - see below;
//first time through function determine if negative numDays should be returned.
returnNeg =
Case (
IsEmpty ( returnNeg );
Case (
endDate > startDate ; False;
startDate > endDate;
True ) "RETURNNEG" );
Perhaps once you have checked this, you could report back here if you concur.
Thanks again - Alan
Alan Stirling, London UK
July 13, 2009 3:09pm