runnerjp Posted September 7, 2008 Share Posted September 7, 2008 ok currently i have my time of post displayed as <?php $dbtime=$getreplies3['showtime']; $time = date("F j Y, g:i a", $dbtime); echo $time;?> but how can i have it shown if it was posted today or yeaterday and a few hours ago? Link to comment https://forums.phpfreaks.com/topic/123120-time-function-ampquot-posted-todayyesterdayampquot/ Share on other sites More sharing options...
BlueSkyIS Posted September 7, 2008 Share Posted September 7, 2008 $now = time(); if ($now - $dbtime > 86400) { // it was greater than 24 hours ago } else if ($now - $dbtime <= 86400) { it was less than or equal to 24 hours ago } Link to comment https://forums.phpfreaks.com/topic/123120-time-function-ampquot-posted-todayyesterdayampquot/#findComment-635823 Share on other sites More sharing options...
runnerjp Posted September 7, 2008 Author Share Posted September 7, 2008 ahh yes thanks i can work with this now Link to comment https://forums.phpfreaks.com/topic/123120-time-function-ampquot-posted-todayyesterdayampquot/#findComment-635861 Share on other sites More sharing options...
runnerjp Posted September 7, 2008 Author Share Posted September 7, 2008 ok what would it be if it was between 24 - 48 hours? Link to comment https://forums.phpfreaks.com/topic/123120-time-function-ampquot-posted-todayyesterdayampquot/#findComment-636041 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.