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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.