473,770 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date Calculation...

I am hoping somebody can help me solve this problem...

I need to write .asp code for a web page that adds 3-7 'business' days
to a given date. I can retrieve the date just fine, but, how do I add
3-7 business days to it (excluding the weekends). I'm not worried about
holidays, just weekends.

Any help would be greatly appreciated!

-T

*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '05 #1
4 3710
"tom feldman" <to********@gma il.com> wrote in message
news:kQ******** *******@news.us west.net...
I am hoping somebody can help me solve this problem...

I need to write .asp code for a web page that adds 3-7 'business' days
to a given date. I can retrieve the date just fine, but, how do I add
3-7 business days to it (excluding the weekends). I'm not worried about
holidays, just weekends.

Any help would be greatly appreciated!

-T

*** Sent via Developersdex http://www.developersdex.com ***


Why "3-7" days?
Play with this -- it adds 3 "business" days to a date:

Option Explicit

Const cVBS = "AddDays.vb s"
Const cDAZ = 3

Dim strDAT
strDAT = InputBox("Enter a date.",cVBS,Dat e)
If IsDate(strDAT) Then
Dim strNEW
strNEW = DateAdd("d",cDA Z,strDAT)
If DatePart("w",st rNEW,vbMonday) >= 6 Then
strNEW = DateAdd("d",2,s trNEW)
End If
WScript.Echo strDAT & " + " & cDAZ & " business days = " & strNEW
End If
Jul 23 '05 #2
"McKirahan" <Ne**@McKirahan .com> wrote in message
news:6K******** ************@co mcast.com...
"tom feldman" <to********@gma il.com> wrote in message
news:kQ******** *******@news.us west.net...
I am hoping somebody can help me solve this problem...

I need to write .asp code for a web page that adds 3-7 'business' days
to a given date. I can retrieve the date just fine, but, how do I add
3-7 business days to it (excluding the weekends). I'm not worried about
holidays, just weekends.

Any help would be greatly appreciated!

-T

*** Sent via Developersdex http://www.developersdex.com ***


Why "3-7" days?
Play with this -- it adds 3 "business" days to a date:

Option Explicit

Const cVBS = "AddDays.vb s"
Const cDAZ = 3

Dim strDAT
strDAT = InputBox("Enter a date.",cVBS,Dat e)
If IsDate(strDAT) Then
Dim strNEW
strNEW = DateAdd("d",cDA Z,strDAT)
If DatePart("w",st rNEW,vbMonday) >= 6 Then
strNEW = DateAdd("d",2,s trNEW)
End If
WScript.Echo strDAT & " + " & cDAZ & " business days = " & strNEW
End If


I offered a VBScript solution as it better supports date math.

ASP readily supports VBScript.
Jul 23 '05 #3
First of all, thank you for taking the time to help me.

I took that script and put it into an .asp page by itself and posted it
to the live server, but it says that the page cannot be displayed? I
cannot run it on my IIS on XP Pro right now because of some conflict I'm
having with SP2 that I installed yesterday. If I could run it, it might
show me where it's having problems...

Now, as I am kind of new to this, could the .vbs script be causing the
problem on the server??

-T

*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '05 #4
"tom feldman" <to********@gma il.com> wrote in message
news:bl******** *******@news.us west.net...
First of all, thank you for taking the time to help me.

I took that script and put it into an .asp page by itself and posted it
to the live server, but it says that the page cannot be displayed? I
cannot run it on my IIS on XP Pro right now because of some conflict I'm
having with SP2 that I installed yesterday. If I could run it, it might
show me where it's having problems...

Now, as I am kind of new to this, could the .vbs script be causing the
problem on the server??

-T


Does your ASP page have JScript and VBScript?

If not, try putting this as the first line in the page:

<% @Language="VBSc ript" %>
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
10114
by: Manny Chohan | last post by:
Hi Can anyone tell me how i can calculate yesterday date using asp? Thanks manny
1
17334
by: Raghu | last post by:
Hello... I am running into a problem while running a query..can some1 help.. this is the query : ************** SELECT * from Table S where S.dtDate1 BETWEEN dateadd(year,1,dateadd(month,-1,getdate())) AND dateadd(day,-1,(dateadd(month,1,dateadd(year,1,dateadd(month,-1,getdate()))))) *************** (first part of the date calculation comes out to be '2005-05-01' and
1
2078
by: mene | last post by:
I have a field that contains date information, and sometimes time information as well. I would like to be able to take that date and do a calculation on it. Here are some examples of what is in the field: 01/12/2003 5:04:00 PM 24/11/2003 19/05/2003 6:30:00 AM How can I take that date, then do a calculation like minus 5 days from the date. I understand that I am to use the GETDATE() function, but below is
4
5390
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and calculate days, months, and years. This is not for a college course. It's for my own personal genealogy website. I'm stumped about the code. I'm working on it but not making much progress. Is there any free code available anywhere? I know it...
3
2730
by: Lindie | last post by:
We need to track how often a book has been loaned. We enter the dates and need an automatic calculation how often in the preceeding 12 months it has been taken out. box 1: today's date box 2: loaned n+1 How do I go about this please? Lindie
2
6787
by: smcgrath via AccessMonster.com | last post by:
I have a table listing accounts with a closed date - our Trial balance drops the account after 7 days but our database keeps the record forever - How do I calculate the end of month less 7 days so that I can get an actual count of the accounts that were closed during the month. I believe that the calculation involves Between(DateSerial(year(Date() etc but I can't figure it out. Thanks, -- Message posted via http://www.accessmonster.com
4
15758
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow which calculated the difference in years and days between two dates, and takes leap years into account? I'm calculating the difference in the usual way, i.e....
1
2656
by: c8tz | last post by:
This is a query I have created that picks up the top 3 dates for this data (for example) : Tree Pos2 Date 1 15 23/08/2005 1 20 12/02/2006 1 32 15/10/2006 2 17 23/08/2005 2 18 12/02/2006
6
9022
by: krishnakant Mane | last post by:
hello, I am strangely confused with a date calculation problem. the point is that I want to calculate difference in two dates in days. there are two aspects to this problem. firstly, I can't get a way to convert a string like "1/2/2005" in a genuan date object which is needed for calculation. now once this is done I will create a another date object with today = datetime.datetime.now() and then see the difference between this today and...
16
4461
by: W. eWatson | last post by:
Are there some date and time comparison functions that would compare, say, Is 10/05/05 later than 09/22/02? (or 02/09/22 format, yy/mm/dd) Is 02/11/07 the same as 02/11/07? Is 14:05:18 after 22:02:51? (24 hour day is fine) How about the date after 02/28/04 is 02/29/04, or the date after 09/30/08 is 10/01/08?
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10257
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10037
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8931
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.