Date math again...

Bob Stockler bob at trebor.iglou.com
Wed Jan 4 12:06:51 PST 2006


Butch Ammon wrote (on Wed, Jan 04, 2006 at 02:07:08PM -0500):

| I have another question regarding dates, calculations, and taking into
| account weekend dates.  Isn't there a simple way of doing this?
| 
| Example:
| 
|   If:
| Then: dd = (10 - 9)
|   If:
| Then: Show "@This is the total number of days " < dd
|   If:
| Then: end
| 
|   Field 9 is the date when the order was entered (i.e.. 12/06/05)
|  Field 10 is the date when the order was shipped (i.e.. 12/21/05)
| 
| Dummy field "dd" comes up saying 15 for the total number of days, which is 
| correct.  **BUT** what about weekends?  It counted Dec 10th, 11th, and also
| Dec 17th and 18th as work days!  Technically, dummy field "dd" should be:
| 11 days.
| 
| My main question:  Does anyone have a quick and easy method of doing date
| math and taking into consideration the weekends inbetween the two dates?

Not without knowing the specifics of the calendar year(s) involved,

In your example, there were two Saturdays and two Sundays, so you
could just subtract four days from the date-math result you got.

But what if the dates were 12/06/05 and 01/21/06 that date-math
says are 46 days apart.  That span includes four Saturdays and
four Sundays, but you can't subtract subtract eight from that
and get the number of work days, because there were two Mondays
that were also holidays.

And the calendar and the days holidays fall on change every year.

Having knowledge of the calendar and the dates holidays fall on,
you could perhaps use the DOW() function in a loop to count the
days between one date and another, skipping days that you do not
consider work days.

Bob


-- 
Bob Stockler  +-+  bob at trebor.iglou.com  +-+  http://members.iglou.com/trebor
Author: MENU EDIT II - The BEST Creator/Editor/Manager for filePro User Menus.
Fully functional (time-limited) demos available by email request (specify OS).


More information about the Filepro-list mailing list