Solved

DateAdd to get previous business day

Posted on 2000-04-20
2
310 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
Comment Utility
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
Comment Utility
Thanks!!!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now