JustinK101 Posted August 6, 2007 Share Posted August 6, 2007 How can I check if a date/time unix timestamp in the format of: $mytime = "1186439997"; Is within 5 days of the current unix timestamp? Basically I need to check if the passed in timestamp was generated within 5 days of today? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/63635-checking-timestamp-against-today/ Share on other sites More sharing options...
JustinK101 Posted August 6, 2007 Author Share Posted August 6, 2007 Ok my bad, I explained this wrong. I need to check if $myDate plus 5 days is greater then time(). How do I add 5 days to $myDate. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/63635-checking-timestamp-against-today/#findComment-317086 Share on other sites More sharing options...
JustinK101 Posted August 7, 2007 Author Share Posted August 7, 2007 Humm I am using this: if((($myDate) + (5 * 24 * 60 * 60)) > time()) I though that would work, but appears not, am I missing something? Quote Link to comment https://forums.phpfreaks.com/topic/63635-checking-timestamp-against-today/#findComment-317095 Share on other sites More sharing options...
teng84 Posted August 7, 2007 Share Posted August 7, 2007 try $x= date("d",118939997); $y= date('d'); echo $x; echo $y; if ($x-$y >5) get the given date and and check if aloder than five days something like that is that right? Quote Link to comment https://forums.phpfreaks.com/topic/63635-checking-timestamp-against-today/#findComment-317097 Share on other sites More sharing options...
corbin Posted August 7, 2007 Share Posted August 7, 2007 That would be fine if you knew the months woudl be the same.... Try //$t is your preset thing.... if(time() < $t + 24*60*60*5)) echo 'It\'s older than five days!'; //or.... $ntime = time() - $t; if($ntime > (24*60*60*5)) echo 'Difference is greater than 5 days!'; Quote Link to comment https://forums.phpfreaks.com/topic/63635-checking-timestamp-against-today/#findComment-317101 Share on other sites More sharing options...
JustinK101 Posted August 7, 2007 Author Share Posted August 7, 2007 This did the trick, thanks. if(time() > (((int)$_GET['key']) + 24*60*60*5)) { echo '<h3>Past Due...</h3>'; } Quote Link to comment https://forums.phpfreaks.com/topic/63635-checking-timestamp-against-today/#findComment-317685 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.