By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,143 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,143 IT Pros & Developers. It's quick & easy.

Calculating total number of weekdays between two dates...

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.