Reputation: 211
I'm stuck with this, I'm trying this code with phalcon framework:
if(strtotime("+5 minutes",$quarantine->getFirst()->datecolumnvalue)>time()){...}
But doesn't work, always give false. I cannot do it with just MySQL because PHQL from phalcon doesn't support it, so I just need a PHP comparison. Regards.
Upvotes: 0
Views: 199
Reputation: 211
This did the trick :) , just an strtotime missing.
if(strtotime("+5 minutes", strtotime($quarantine->getFirst()->datecolumnvalue))>time()){...}
Upvotes: 1
Reputation: 6381
Your logic is simply backwards. Just flip >
to <
:
if (strtotime("+5 minutes",$quarantine->getFirst()->datecolumnvalue) < time()) {
...
}
You want cases where, even if you add 5 minutes to the database time, it's still LESS THAN (before) the current time.
Upvotes: 0