Jump to content

[SOLVED] Changing dates in the past...


Yammyguy

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

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.