|
-
Jul 13th, 2004, 09:56 AM
#1
Thread Starter
Hyperactive Member
Datediff question (RESOLVED)
Hi,
I am writing a small helpdesk utility and wish to report the number of calls resolved within seven days. The code below works great but I'd like to be able calculate the first day as monday. e.g, show all calls resolved from last monday
anyone help me please?
Code:
if DateDiff("d",ors.fields("ResolvedDate"),now)<=7 then
resolvedin = resolvedin + 1
end if
Last edited by cajsoft; Jul 15th, 2004 at 03:51 AM.
Craig Johnstone, MCP,CNA
VB 6,SQL,Lotus Notes,Crystal Reports 7,8
http://www.cajsoft.co.uk/downloads.htm
-
Jul 13th, 2004, 11:08 AM
#2
Frenzied Member
Just to clarify...
If you wanted to view calls resolved for this week that would cover Monday 12th and Tuesday 13th.
If you wanted last weeks numbers that would be between Monday 5th and Sunday 11th.
Does this sound right?
DJ
-
Jul 13th, 2004, 12:27 PM
#3
Thread Starter
Hyperactive Member
Yes Thats correct.. each week I want to show calls resolved from previous monday through to sunday night.
Craig Johnstone, MCP,CNA
VB 6,SQL,Lotus Notes,Crystal Reports 7,8
http://www.cajsoft.co.uk/downloads.htm
-
Jul 14th, 2004, 04:13 AM
#4
Fanatic Member
Try:
Code:
if DateDiff("d",ors.fields("ResolvedDate"),now,2)<=7 then
resolvedin = resolvedin + 1
end if
By adding the 2 into the function you are telling it the first day of the week is a Monday, is this what you meant?
-
Jul 14th, 2004, 03:49 PM
#5
Thread Starter
Hyperactive Member
Originally posted by davebat
Try:
Code:
if DateDiff("d",ors.fields("ResolvedDate"),now,2)<=7 then
resolvedin = resolvedin + 1
end if
By adding the 2 into the function you are telling it the first day of the week is a Monday, is this what you meant?
It's still showing more calls resolved than there should be. Only 7 calls were resolved since monday, but it's showing all calls from 7 days ago.?
Craig Johnstone, MCP,CNA
VB 6,SQL,Lotus Notes,Crystal Reports 7,8
http://www.cajsoft.co.uk/downloads.htm
-
Jul 15th, 2004, 01:49 AM
#6
Fanatic Member
try this then, it will look back to the p[ast seven days as you have hard coded this number in. Use a variable instead.
Code:
<%
V_DAY = weekday(date(),2)
if DateDiff("d",ors.fields("ResolvedDate"),now,2)<= V_DAY then
resolvedin = resolvedin + 1
end if
%>
I think the easiest way to do this would be within the sql, so that it only pulls out records that fallw ithin the two dates. If you need help doing this let me know.
-
Jul 15th, 2004, 03:51 AM
#7
Thread Starter
Hyperactive Member
Cheers mate. Thats whay I was looking for.
Craig Johnstone, MCP,CNA
VB 6,SQL,Lotus Notes,Crystal Reports 7,8
http://www.cajsoft.co.uk/downloads.htm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|