473,462 Members | 1,055 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Calculating total number of weekdays between two dates...

hey all..... alright, I am frusterated to the point of throwing my
machine out
the window (this board went down, trying to find stuff on google, this
has been
a nightmare) so I hope you guys can help me with a solution. This is
what I am
trying to do:

Pretty much, there are two dates in my database, a start date, and an
end
date. I need to calculate the number of total days between the two
EXCLUDING
weekends. This is for a vacation tracker, so I need to calculate the
total
number of business days they are requesting off......

Thank you SOOOO much in advance. Donno what i would do without you
guys. I am primarily a coldfusion developer, but for this project I
have to use ASP, so exuse the stupidity. I also prefer to develop
with VB if possible. Thanks guys!
Jul 19 '05 #1
4 12660
If you've used VB before then you should be used to the DateDiff
function..... also available with ASP ;o)

http://www.drdev.net/article05.asp

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
John <ra***********@hotmail.com> wrote in message
news:e5**************************@posting.google.c om...
hey all..... alright, I am frusterated to the point of throwing my
machine out
the window (this board went down, trying to find stuff on google, this
has been
a nightmare) so I hope you guys can help me with a solution. This is
what I am
trying to do:

Pretty much, there are two dates in my database, a start date, and an
end
date. I need to calculate the number of total days between the two
EXCLUDING
weekends. This is for a vacation tracker, so I need to calculate the
total
number of business days they are requesting off......

Thank you SOOOO much in advance. Donno what i would do without you
guys. I am primarily a coldfusion developer, but for this project I
have to use ASP, so exuse the stupidity. I also prefer to develop
with VB if possible. Thanks guys!

Jul 19 '05 #2
Steven Burn wrote:
If you've used VB before then you should be used to the DateDiff
function..... also available with ASP ;o)


how does this help him calculate weekdays?

If no one else answers, I'll get back to this later. It seems to me that a
Google search should help ...

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #3
Best to use a calendar table. Since my weekdays / holidays might differ
from yours (consider the case where the person's vacation request overlaps
with Thanksgiving or Christmas).

http://www.aspfaq.com/2453

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

"John" <ra***********@hotmail.com> wrote in message
news:e5**************************@posting.google.c om...
hey all..... alright, I am frusterated to the point of throwing my
machine out
the window (this board went down, trying to find stuff on google, this
has been
a nightmare) so I hope you guys can help me with a solution. This is
what I am
trying to do:

Pretty much, there are two dates in my database, a start date, and an
end
date. I need to calculate the number of total days between the two
EXCLUDING
weekends. This is for a vacation tracker, so I need to calculate the
total
number of business days they are requesting off......

Thank you SOOOO much in advance. Donno what i would do without you
guys. I am primarily a coldfusion developer, but for this project I
have to use ASP, so exuse the stupidity. I also prefer to develop
with VB if possible. Thanks guys!

Jul 19 '05 #4
guys,
thanks for the help thus far..... but i am trying to do something
along these lines with a SQL statement if possible... (couldn't get
that aspfaq page to function correctly) here, take a look. this is
what i got thus far.

SELECT Count([Table2].[SomeDate])
AS CountOfSomeDate
FROM Table2, eventlist
WHERE (((Table2.somedate) Between [eventlist.sdate] And
[eventlist.edate]) AND ((Weekday([somedate])-1)<6) AND
([eventlist].[uID] = 'Request.QueryString('" + uID + "')'))
this SQL statement (minus the request.querystring) WORKS for
calculating week days when I run it as a query in access (as static,
for instance, i say AND eventlist.uID = "jegbert") .... it gives me an
accurate output.... but when i run the previous SQL statement, it
gives me 0 (when it should be 7). I am pretty sure my syntax for the
"request.querystring" on to the end is wrong, I have a feeling it is
instead of pulling the uID "jegbert" from the database, its instead
saying "Where eventlist.uID = "Request.Querystring(uID)" .... and of
course there is no uID in my table called "Request.Querystring(uID)"
.... So, any suggestions??!?!? I AM SOOOOO CLOSE!!!!

Thanks in advance guys, I would be dead in water if I didnt have such
good help.
John
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message news:<OB**************@TK2MSFTNGP10.phx.gbl>...
Best to use a calendar table. Since my weekdays / holidays might differ
from yours (consider the case where the person's vacation request overlaps
with Thanksgiving or Christmas).

http://www.aspfaq.com/2453

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

"John" <ra***********@hotmail.com> wrote in message
news:e5**************************@posting.google.c om...
hey all..... alright, I am frusterated to the point of throwing my
machine out
the window (this board went down, trying to find stuff on google, this
has been
a nightmare) so I hope you guys can help me with a solution. This is
what I am
trying to do:

Pretty much, there are two dates in my database, a start date, and an
end
date. I need to calculate the number of total days between the two
EXCLUDING
weekends. This is for a vacation tracker, so I need to calculate the
total
number of business days they are requesting off......

Thank you SOOOO much in advance. Donno what i would do without you
guys. I am primarily a coldfusion developer, but for this project I
have to use ASP, so exuse the stupidity. I also prefer to develop
with VB if possible. Thanks guys!

Jul 19 '05 #5

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

Similar topics

2
by: Tiernan | last post by:
Hi all I'm looking for a way to find the number of weekdays between 2 dates In my form I have three fields for a begin date (dd)(mm)(yyyy) and three for the end date (dd)(mm)(yyyy) Now these...
4
by: Hans Gruber | last post by:
Hi all, I have been struggling with a problem all day, I have been unable to come up with a working solution. I want to write a function which takes 2 unix timestamps and calculates the...
5
by: SimonC | last post by:
Help needed for a Javascript beginner. As above in the subject... i need a javascript to run this, but not in the form of a web-page. I want to calculate it between 2 fields in a database that...
0
by: hlam | last post by:
Help - Calculating the total of a column in a data grid -- when data grid is part of Master-Detail set-up I have setup a Master-Detail form using Visual Studio.Net. A ListBox is the (Master)...
1
by: Chris Hill via .NET 247 | last post by:
Hi I'm a jnr developer in need of desparate help. Can anyone point me in the right direction for this problem: I calculate the number of days between 2 user defined dates like this: Dim...
10
by: Lisa | last post by:
In translating the formula for calculating lottery odds for various conditions into a Visual Basic Program, I have apparently missed something in that I get errors in the part of the calculation...
9
by: mankolele | last post by:
Hi all I need an idea on where to start when calculating a total amount betwee n two dates from a database like I want amount of money paid out from 30/03/2004 and 30/07/2004 ,but in the database...
3
rcollins
by: rcollins | last post by:
I ahve a database that I put together to keep track of the office supplies. We input what has been purchased and what goes out. When I run a report, usually it is just for a month, but I have a...
1
by: bharathreddy | last post by:
This article will explain how we can get the count of weekdays in between two dates. This will be usefull if we want to count the number of working days between two dates. Example: -------------...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
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 ...

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.