The title says it all.. I am not sure what is wrong with my code.. But it didn't go well as i want to
<?php
//test this
$query = odbc_exec($conn, "SELECT * FROM changepass_req WHERE reqid = 1");
$reqdate = odbc_result($query, 'req_date');
$reqdatex = strtotime($reqdate);
$timenow = date("Y-m-d H:i:s");
$timenowx = strtotime($timenow);
if($timenowx <= $reqdatex + 86400) {
//Less than 24 hours
echo'Go a head, its not a day passed yet';
}
else {
//More than 24 hours
echo'Sorry, this request is expired!';
}
?>
The req_date
that's in the database is in varchar of datatype. Thanks for the help in advance
EDIT : ALSO the req_date data's are in this format (Y-m-d H:i:s)
EDIT 2 : The return of var_dump($reqdatexx) looked like this in my page : int(1370855859)
EDIT 3 : Here's the concept i want.. If Database time is before OR WITHIN 24 hours of the CURRENT TIME = return true ELSE // if the Database time is BEYOND or PASSED 24 hours of the CURRENT TIME = return false
or , if Database time = 2013 6/8 5:02pm AND Current time = 2013 6/9 5:01pm = return TRUE else //Database time = 2013 g/6 5:02pm AND Current time = 2013 6/9 5:03pm = return FALSE