goodban Posted May 31, 2012 Share Posted May 31, 2012 I'm having a hard time trying to figure out strtotime and adding and subtracting days. I have a digital logbook that I am trying to sort by day so when I log in I only see entries for that day, but I want to create links where I can flip through days. echo date("Y-m-d", strtotime($row_logbook['timestamp'])); Where can I put -1 day or +1 day? Any help would be appreciated. I've searched google endlessly and cannot figure it out. Quote Link to comment https://forums.phpfreaks.com/topic/263408-date-help/ Share on other sites More sharing options...
requinix Posted May 31, 2012 Share Posted May 31, 2012 Here is a good place to look for answers. Quote Link to comment https://forums.phpfreaks.com/topic/263408-date-help/#findComment-1350000 Share on other sites More sharing options...
goodban Posted May 31, 2012 Author Share Posted May 31, 2012 I actually figured it out. <?php echo date("Y-m-d", strtotime("-1 day", strtotime($row_logbook['timestamp'])));?> Now I'm just running into the issues with if there are no entries for the that date it sends to default 12/31/1969. I'm still very new at this and am trying to teach myself with the help of Dreamweaver. Quote Link to comment https://forums.phpfreaks.com/topic/263408-date-help/#findComment-1350011 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.