Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Testing for business dates.

Author  Topic 

Joe Kauffman
Starting Member

1 Post

Posted - 2005-08-23 : 12:24:51
Hi all,

I have a query that I need some help with. I have a date field called docdate and I need to be able to add 5 business days to it and display the outcome in an asp page. I have worked with dates quite a bit, but this is the first time that I am having to deal with just business days.

Thanks for any help.

Joe Kauffman

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2005-08-23 : 12:29:51
quote:
Originally posted by Joe Kauffman

Hi all,

I have a query that I need some help with. I have a date field called docdate and I need to be able to add 5 business days to it and display the outcome in an asp page. I have worked with dates quite a bit, but this is the first time that I am having to deal with just business days.

Thanks for any help.

Joe Kauffman



Do you have any code or date formats that we could look at?

Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!
Go to Top of Page

safecoder@gmail.com
Starting Member

22 Posts

Posted - 2005-08-23 : 12:47:18
This mught help...Good luck!

http://www.eggheadcafe.com/articles/20030626.asp
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-08-23 : 13:33:56
The functions that safecoder linked to should get you started. The second one displays the number of business days between two dates. You'll need to massage it a little in order to get it to return a date that is X business days from another date, but that shouldn't be too tough.

But be sure to define what a business day really is for your situation. For example, I did some work in the financial sector and we had to distinguish between our own company's business days, and our bank's business days because they were not on the same holiday schedule, and some things could occur on days that were banking days even if they were not our own business days, some things could occur only on our business days, regardless of whether it was a banking day, and some things could only occur on days that were both business and banking days. So, be sure to clearly define what you mean by something being a business day.

If you are only worried about one definition, then you could just create a table of exceptions to compare to. For our situation, we actually created a table of every day and tagged each one. Either way, you'll probably need to create a job or a business procedure to be sure the table is populated far enough into the future, and perhaps validated at the beginning of the year in case a new holiday is declared.

---------------------------
EmeraldCityDomains.com
Go to Top of Page
   

- Advertisement -