0

I have a MYSQL datetime that looks like this - 2011-08-28 12:39:21

I need (in PHP) to see if the time is within 3 minutes of the current time. I know how to do it in MySQL like 'BETWEEN NOW()-INTERVAL 3 MINUTE AND NOW()', But in this case I need to do it in PHP.

Advice on how to findout if the datetime is within the last 3 minutes or now?

cheers

2 Answers 2

1

Use this function:

if (strtotime($datetime) >= time() - 180) {
    // within last three minutes or later
}
Sign up to request clarification or add additional context in comments.

Comments

0

This is not possible.

if (strtotime($datetime) >= time() - 180) {
    // within last three minutes or later
}

if you dont upgrade from your server MYSQL 5.2 and plus your dont fixed this.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.