Solved

DateAdd to get previous business day

Posted on 2000-04-20
2
315 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

632 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