ahs10 Posted August 2, 2007 Share Posted August 2, 2007 i have a variable, $strTemp3 that equals the date a post was made to a message board. the format of this variable is 08/02/07. i would like to determine if this date is older than two days or not. how would i do that? Quote Link to comment https://forums.phpfreaks.com/topic/63062-solved-determining-the-the-age-of-a-date/ Share on other sites More sharing options...
ahs10 Posted August 2, 2007 Author Share Posted August 2, 2007 sorry, i thought i asked this question before, but when i searched the board it didn't come up. i found that post by doing an advanced search and it was answered in there. here's the answer i'm using.... <?php $post = the-post-date; $old = date("m-d-Y", strtotime("2 days ago")); if ($post <= $old) { // The post is 2 days old or older } else { //The post is less than 2 days old. } ?> Quote Link to comment https://forums.phpfreaks.com/topic/63062-solved-determining-the-the-age-of-a-date/#findComment-314066 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.