View Full Version : DateDiff
05-07-2007, 07:17 PM
Hi there...I am trying to see if a Followup date matches exactly with the time now....dont know if both are in the same format and wonder if something like this might work? The Followup date from the database shows: 5/7/2007 1:14:00 PM
<% if datediff("s",Now, AllRecords("FollowupDate"))=60 then
05-08-2007, 03:28 PM
I would do something like:
fol_date = CDate(AllRecords("FollowupDate"))
If (DateDiff("d", Date, fol_date) = 0) Then
'Code for same dates
'Code for different dates
When grabbing from a DB, I always find it best practice to do a conversion on the value to make sure it's in the right format, which is why I use CDate() on the FollowupDate value. I then do a DateDiff on the "day" value to see if they differ in days at all. If they don't, the difference will be zero, and so you can execute the code that performs when the two dates are the same.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.