Jump to content

+/- date help


goodban

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/263408-date-help/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/263408-date-help/#findComment-1350011
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.