PC Review


Reply
Thread Tools Rate Thread

DateAdd ignoring Week-ends

 
 
Question Boy
Guest
Posts: n/a
 
      19th Feb 2009
Is there away to do a DateAdd but ignoring the week-ends?

Let say I use today as an example 02/19/2009 and I need to Add 18 hours. I
need it to add the hours assuming 8 hours = 1 day and ignoring the week-end.
As such it would return.

18/8=2.25 days ... so 3 days
20 = 1
21 ignore
22 ignore
23 = 2
24 = 3

so the answer returned would be 02/24/2009.

Thank you!

QB
 
Reply With Quote
 
 
 
 
David H
Guest
Posts: n/a
 
      19th Feb 2009
Never had the pleasure of that, as I've never been in an industry that shut
down on weekends...and I wonder why I don't have a life.

I do know that the subject has come up often. Try googling for it.


"Question Boy" wrote:

> Is there away to do a DateAdd but ignoring the week-ends?
>
> Let say I use today as an example 02/19/2009 and I need to Add 18 hours. I
> need it to add the hours assuming 8 hours = 1 day and ignoring the week-end.
> As such it would return.
>
> 18/8=2.25 days ... so 3 days
> 20 = 1
> 21 ignore
> 22 ignore
> 23 = 2
> 24 = 3
>
> so the answer returned would be 02/24/2009.
>
> Thank you!
>
> QB

 
Reply With Quote
 
Question Boy
Guest
Posts: n/a
 
      19th Feb 2009
I found a nice bit of code at the MVPs site but sadly it does not seem to
permit substraction (negative numbers) which I need.

Anyone have a bit of code that allows substration of dates ignoring week-end?



"David H" wrote:

> Never had the pleasure of that, as I've never been in an industry that shut
> down on weekends...and I wonder why I don't have a life.
>
> I do know that the subject has come up often. Try googling for it.
>
>
> "Question Boy" wrote:
>
> > Is there away to do a DateAdd but ignoring the week-ends?
> >
> > Let say I use today as an example 02/19/2009 and I need to Add 18 hours. I
> > need it to add the hours assuming 8 hours = 1 day and ignoring the week-end.
> > As such it would return.
> >
> > 18/8=2.25 days ... so 3 days
> > 20 = 1
> > 21 ignore
> > 22 ignore
> > 23 = 2
> > 24 = 3
> >
> > so the answer returned would be 02/24/2009.
> >
> > Thank you!
> >
> > QB

 
Reply With Quote
 
David H
Guest
Posts: n/a
 
      19th Feb 2009
DateAdd() can be used to subtract days from a date by simply making the
interval negative.

"Question Boy" wrote:

> I found a nice bit of code at the MVPs site but sadly it does not seem to
> permit substraction (negative numbers) which I need.
>
> Anyone have a bit of code that allows substration of dates ignoring week-end?
>
>
>
> "David H" wrote:
>
> > Never had the pleasure of that, as I've never been in an industry that shut
> > down on weekends...and I wonder why I don't have a life.
> >
> > I do know that the subject has come up often. Try googling for it.
> >
> >
> > "Question Boy" wrote:
> >
> > > Is there away to do a DateAdd but ignoring the week-ends?
> > >
> > > Let say I use today as an example 02/19/2009 and I need to Add 18 hours. I
> > > need it to add the hours assuming 8 hours = 1 day and ignoring the week-end.
> > > As such it would return.
> > >
> > > 18/8=2.25 days ... so 3 days
> > > 20 = 1
> > > 21 ignore
> > > 22 ignore
> > > 23 = 2
> > > 24 = 3
> > >
> > > so the answer returned would be 02/24/2009.
> > >
> > > Thank you!
> > >
> > > QB

 
Reply With Quote
 
David H
Guest
Posts: n/a
 
      19th Feb 2009
Is it this article... http://www.mvps.org/access/datetime/date0006.htm?

What do you need to subtract? Do you need to spread the 18 hours over
however many business days?

"Question Boy" wrote:

> I found a nice bit of code at the MVPs site but sadly it does not seem to
> permit substraction (negative numbers) which I need.
>
> Anyone have a bit of code that allows substration of dates ignoring week-end?
>
>
>
> "David H" wrote:
>
> > Never had the pleasure of that, as I've never been in an industry that shut
> > down on weekends...and I wonder why I don't have a life.
> >
> > I do know that the subject has come up often. Try googling for it.
> >
> >
> > "Question Boy" wrote:
> >
> > > Is there away to do a DateAdd but ignoring the week-ends?
> > >
> > > Let say I use today as an example 02/19/2009 and I need to Add 18 hours. I
> > > need it to add the hours assuming 8 hours = 1 day and ignoring the week-end.
> > > As such it would return.
> > >
> > > 18/8=2.25 days ... so 3 days
> > > 20 = 1
> > > 21 ignore
> > > 22 ignore
> > > 23 = 2
> > > 24 = 3
> > >
> > > so the answer returned would be 02/24/2009.
> > >
> > > Thank you!
> > >
> > > QB

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compressed week-ends always SAT/SUN on outlook-2003/XP samson Microsoft Outlook Calendar 9 13th Aug 2008 03:06 PM
Is it good to shutdown a low loaded server for week-ends Chereda Support 4 30th Jul 2007 12:36 PM
DateAdd 1st day in Week ? john Microsoft Access Form Coding 5 9th May 2007 10:32 AM
date to day of week ignoring blank cells emm8080 Microsoft Excel Misc 8 2nd Aug 2004 10:24 PM
Compacting front ends and back ends Deb Struble Microsoft Access Database Table Design 2 15th Sep 2003 06:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:49 AM.