Jan,

Historically I have found building a table full of business days works best, so 
that you can take into account holidays and special days off/snow days
Along with a business day flag y/n
Put one row in for each business day for the year using a simple loop and Idwk 
function and a Y flag and then go flip the flag on the holidays and any other 
special days when you don’t operate.

Then you can just count the number of rows between any two dates where the flag 
= 'Y'.

I actually had an app with 2 flags because the company was a car auction so 
actual business days for sellers and buyers were not always the same so there 
was a flag for each because sometimes it might not be a business day for the 
sellers if you cant go pickup cars because of a snowstorm, but are open for 
buyers who can make in to the location to pay their bills.  This data was used 
for calculating buyer storage and seller pickup SLA reports.

Just depends on your application and what you need to accomplish with it.

Troy


-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of A. 
Razzak Memon
Sent: Tuesday, March 16, 2021 5:25 AM
To: [email protected]
Subject: Re: [RBASE-L] - Date calculation

Jan,

Here's how ...

Use the IDWK function to exclude the 6th and 7th (Saturday and
Sunday) day of the Week.
-- IDWK returns the day of the week where Monday is 1.

-- Example 01
SELECT * FROM tablename WHERE (IDWK(datecolumn)) NOT IN (6,7)

-- Example 02
SELECT * FROM tablename WHERE (IDWK(datetimecolumn)) NOT IN (6,7)

That's all there is to it!

Have fun.

Very Best R:egards,

Razzak



At 07:15 AM 3/16/2021, jan johansen wrote:

>Group,
>
>Anyone got a good date algorithm that ignores weekends? Or in other 
>words, only counts workdays?
>
>Jan







--
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/0Lm2Pn-1lvSWt3yqH-00Zixe%40mrelay.perfora.net.

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/CH2PR06MB67435C0EED5561DE3F4BB1FD9C6B9%40CH2PR06MB6743.namprd06.prod.outlook.com.

Reply via email to