Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date and time difference

Status
Not open for further replies.

parames

MIS
Jun 26, 2000
71
MY
Greetings,

I'm using mysql database. When the end user submit the form, we do keep the date and the time the form submitted. Thr problem is, at a particular time, how to calculate whether the time the form was submitted is already past 1 hour.

In the other words, whenever i run a program,the program should get the date and time from the database , compare with the date and time at that time and calculate whether the duration is one hour or not...

And FYI, one day = 7am up to 7am (the next day).. it's not from 12 to 12... which means,
Let say, today's date is 5/5/2003 AND

1) if the form is submmited at 6.59am, the date will be 4/5/2003 and time will be 6.59am ..BUT,
2) if the form is submitted at 7.03 am, the date will be 5/5/2003 and time will be 7.03 am..

So,how to do the calculation?? Please help..

Thanks and best regards,
Parames.s
 
You could use DateDiff and request the number of minutes differance, if it is greater than 60 you have a winner :)

Code:
If DateDiff("n",myDate, Now()) > 60 Then
   Response.Write "More than an hour"
Else
   Response.Write "Less than an hour"
End If

-Tarwn


[sub]01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101 [/sub]
[sup]29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19[/sup]
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top