Joey Martin wrote:
Please look at code below. I am trying to compare the NOW time with a
"deadline" time. Please help. Just not sure why this is not working. I
need to be able to say IF IT'S BEFORE 9:30 TODAY, IT'S OKAY TO ADD
SOMETHING. IF IT'S AFTER 9:30 TODAY, YOU MUST ADD IT TOMORROW.
CODE:
nowtime=now()
deadlinetime=formatdatetime(now(),2) + " 8:30:00 AM"
formatdatetime returns a string. You are doing a string comparison
instead of a datetime comparison. Change this to:
deadlinetime = dateadd("n",30,dateadd("h",8,date()))
or, if you are committed to using formatdatetime, do this:
deadlinetime=formatdatetime(now(),2) + " 8:30:00 AM"
deadlinetime=CDate(deadlinetime)
Personally, I prefer the former
--
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.