e1seix Posted January 6, 2009 Share Posted January 6, 2009 how would i go about using a timestamp of todays date to determine if another variable timestamp is more than 2 days old? am probably not phrasing that very well in google as not getting any results that help me? cheers! Quote Link to comment https://forums.phpfreaks.com/topic/139759-solved-timestamp-query/ Share on other sites More sharing options...
premiso Posted January 6, 2009 Share Posted January 6, 2009 In php...this is one way. <?php $timePlus2 = time()+3600*24*2; ?> Would get you a timestamp of +2days, You can also use the strtotime function, but yea. Either would work. Quote Link to comment https://forums.phpfreaks.com/topic/139759-solved-timestamp-query/#findComment-731193 Share on other sites More sharing options...
dennismonsewicz Posted January 6, 2009 Share Posted January 6, 2009 here is something on comparing dates http://www.highlystructured.com/comparing_dates_php.html Quote Link to comment https://forums.phpfreaks.com/topic/139759-solved-timestamp-query/#findComment-731194 Share on other sites More sharing options...
e1seix Posted January 6, 2009 Author Share Posted January 6, 2009 <? //getting days in between 2 timestamps; $start = "2009-01-05"; $end = date("Y-m-d"); echo "\$start: ".strtotime($start)."<br>"; echo "\$end: ".strtotime($end)."<br>"; $difference = (strtotime($end)-strtotime($start)); $days = $difference/24; //hours in one day $days = $days/60; //minutes in one hour $days = $days/60; //seconds in one minute $days = ceil($days); //rounding up echo "\$days in between: $days"; ?> have found this curious little script which does exactly what i wanted... for any of you that are looking for similar. Quote Link to comment https://forums.phpfreaks.com/topic/139759-solved-timestamp-query/#findComment-731215 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.