date + 2 minutes?

I have a date/time from SQL that looks like 2014-01-14 16:49:21
I have a Xojo Date and I need to know if the date/time is 2 minutes (or more) from the SQL date.

dim NextExec as new date
dim LastExec as new date
dim Now as new date
    
LastExec.SQLDateTime = "2014-01-14 16:49:21"  // not a constant but just for this forum post....
NextExec = LastExec
NextExec.Minute = NextExec.Minute + 2
    
if Now >= NextExec then
   // Its been 2 minutes of more.
end if

Does this look right?

NextExec.TotalSeconds = LastExec.TotalSeconds

Remember, dates are objects, so without the .TotalSeconds, you’ve linked NextExec and LastExec together by pointing them at the same object.

if Now.TotalSeconds >= NextExec.TotalSeconds then

Unless they’ve added the comparison operators to Dates while I wasn’t looking…

They’ve been there for some time.

Ah, was mixing up the idea of comparing dates with that of subtracting them. The first part still holds, though.