Jump to content

Recommended Posts

Hello,  I'm looking for a solution to change a date in the past.

 

Say, for example - I have a date displayed as: YYYY/MM/DD - 2008/10/12

 

What I would like to do is move that date back by one day.  I've tried the simple stuff like exploding it, subtracting the array[2] by one, then imploding it. 

 

That would be fine, but the problem is if it's the first of a new month - then things get sticky.

 

I've tried the mktime() function by writing something like this:

 

mktime(0,0,0,array[1], (array[2] - 1), array[0]); 

 

That returned some pretty funky values - obviously not what I wanted.

 

Does anyone have any suggestions? or is this too specific, and I'm going to have to write a whole function that checks for new month, and determines which month it is and therefore applies the appropriate logic for that month?

 

Thanks very much in advance!

 

~C.

Link to comment
https://forums.phpfreaks.com/topic/149653-solved-changing-dates-in-the-past/
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.