Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DateAdd to get previous business day

Posted on 2000-04-20
2
Medium Priority
?
317 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 400 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

670 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