June 18th, 2003, 04:14 AM
How to compare time
This is my the part of the code in asp in which i want that if record is getting submitted between morning 6 am to night 12 pm
the value of sdate should be current date or if the time is between night 12 to morning 6 the value of sdate should be the previous date but this comparison is not working please help me.
if (time()>"06:00:00 AM") and (time()<"07:00:00 AM") then
sdate = Year(Date()) & "-" & Month(Date()) & "-" & Day(Date())
I am using MySQL as my backend
Thanx in advance Rahul
Small things lead to perfection and perfection is not a small thing.
June 18th, 2003, 10:06 AM
want to have a look into the DateDiff() function and yes you can compare time, there is no TimeDiff() function...have a look here:
Also, you are comparing time() with a string that looks like a time value "06:00:00 AM" but in fact it is a string...
try converting that *string* using Cdate()
if (time()>CDate("06:00:00 AM")) and (time()<CDate("07:00:00 AM")) then
. . .
try that otherwise look into the DateDiff() function
Hope this helps!
March 26th, 2013, 09:26 AM
Originally Posted by rgdubey
March 26th, 2013, 02:57 PM
This is not an acceptable question, and you have resurrected a 9 year old thread.
Originally Posted by destinystar
This topic is closed.
Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.