472,958 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

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 12625
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: -------------...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.