Code: Select all
$old_time = date("F n, Y H:i:s");
$more = 4;Code: Select all
$current = date("F n, Y H:i:s");NOTE: the old_time is comming from a database entry. not date("F n, Y H:i:s");
Moderator: General Moderators
Code: Select all
$old_time = date("F n, Y H:i:s");
$more = 4;Code: Select all
$current = date("F n, Y H:i:s");Code: Select all
$more = 4;
$current = date("F n, Y H:i:s", strtotime('+'. $more .' hours', time()));If I recall the function correctly, F means January through December and n (months as well) 1-12. So where's the day?tecktalkcm0391 wrote:I have the date as:
How do I make it add $more hours to the $old_time and then compare it to the current timeCode: Select all
$old_time = date("F n, Y H:i:s"); $more = 4;and if the new time is >= current time, then it returns false, otherwise it returns true.Code: Select all
$current = date("F n, Y H:i:s");
NOTE: the old_time is comming from a database entry. not date("F n, Y H:i:s");
Code: Select all
$more = 4;
$current = date("F n, Y H:i:s", strtotime('+'. $more .' hours', time()));Code: Select all
$get_update = mysql_query("SELECT * FROM `update`");
$get = mysql_fetch_array($get_update)
$old_time = $get['OldTime'];
$more = 4;Code: Select all
<?php
function checktime($dbdate){
$dbtime = strtotime($dbdate)+4*3600;
$ctime = date("U");
return ($dbtime >= $ctime) ? false : true;
}
//$dbdate = "January 01, 1999 02:22:13";
$dbdate = "June 16, 2006 19:07:13";
if(!checktime($dbdate)) {echo "entry less than (or exactly) four hours old";}
else {echo "entry more than four hours old";}
?>