Adding Days To A Date

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Adding Days To A Date

Post by icesolid »

OK, I need to take the current date and add 24 days onto it. How would I do that so the months and days all make sense? I mean I could break out the day of the month, but I don’t understand how to make it change to the next month.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

This may be useful to you ;)

Code: Select all

//whatever your date in timestamp is
$currentTime = time();
$futurDate = strtotime('+24 days', $currentTime);
echo date('M-d-Y', $futurDate);
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

Code: Select all

echo date("m/d/Y",strtotime("+24 days"));
Post Reply