php - How to check if the time stored in database exceeded two hours -


each time password reset req link clicked, store time using now() phpfunction user table in form:

2015-06-15 12:02:09

how check date , time in format if exceeded 2 hours? simple 2*60*60 help?

date taken consideration too.. if clicked link day after , before specified time?

strtotime() you're looking if want php. have been helpful see code you've tried.

<?php $timediff = strtotime('now') - strtotime('2015-06-15 00:02:09'); // in seconds  if( $timediff > 7200 ) { // 7200 seconds 2 hours     // stuff; } ?> 

this take date account you've asked because strtotime function returns amount of time in seconds has passed since epoch time (jan 1, 1970).


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -