|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
datetime problem
Hi everyone!
I am a beginning ASP programmer and I am trying to use the datetime function. I am using Access as my backend database if you are wondering. I am building a program where someone can keep track of the software in our department and she wanted it to be able to email her when the software has been checked out for over 7 days. Does anyone know how to do this or where I begin? I am not too familiar with how one would add to dates in ASP. Thanks in advance! |
|
#2
|
|||
|
|||
|
|
|
#3
|
||||
|
||||
|
Use the dateDiff function:
Code:
<%
if DateDiff("d",theDate, Now) > 7 then
'The code to send the message
end if
%>
Where theDate is the date the stuff is lended (Now is a VB function that will get today's date) You can also use sql to get all the records where the difference in date is larger than 7: Code:
<% dim sqlstr dim oRec 'Your connection statements sqlstr = "select * from tblTheTable where datediff(day, dtCheckedOut, getdate()) > 7" oRec.execute(sqlstr) while not oRec.eof 'Youre e-mail message oRec.moveNext wend %> The problem with this code is that a message will be send every time it is run, and it is longer than 7 days (not just once). Hope this helped! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > datetime problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|