Solved

DateAdd to get previous business day

Posted on 2000-04-20
2
313 Views
Last Modified: 2009-12-16
How would I code a DateAdd function to get the previous business day?  The below gets the previous day, but I want the previous business day, M-F.

DateAdd("d","4/17/2000",-1) = "4/16/2000" (Sunday)
0
Comment
Question by:gabrielf072699
2 Comments
 
LVL 1

Accepted Solution

by:
jbilsten earned 100 total points
ID: 2735595
Well first off, I believe DateAdd is (interval, number, date)

Then your solution is this:

<%

Date = "4/16/2000"

Select Case WeekDay(DateAdd("d",-1,Date))
   Case 1 'Sunday
      Date = DateAdd("d",-3,Date)
   Case 7 'Saturday
      Date = DateAdd("d",-2,Date)
   Case Else
      Date = DateAdd("d",-1,Date)
End Select

%>

Good Luck
0
 

Author Comment

by:gabrielf072699
ID: 2736451
Thanks!!!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question