Solved

# date calculation

Posted on 2004-08-04
Medium Priority
181 Views
can someone tell me how to add the current date with a digit?
Example:

2004-08-30 + 5 = 2004-07-04

thank you!!!
0
Question by:spacelife23
• 2
• 2

LVL 25

Accepted Solution

Marcus Bointon earned 80 total points
ID: 11713352
\$newdate = date('Y-m-d', strtotime('+5 day', strtotime('2004-08-30')));
0

LVL 26

Expert Comment

ID: 11713839
0

LVL 25

Expert Comment

ID: 11713953
Be warned - That's an old article that doesn't cover the wonders of strtotime, instead writing reams of code that does less.
0

LVL 3

Expert Comment

ID: 11717663
Here is what i do

This works with the current date

\$date1 = mktime (0,0,0,date("m") ,date("d")-5,date("Y"));
\$date = date("m/d/y", \$date1);

echo "\$date";
0

LVL 3

Expert Comment

ID: 11717689
if you wanted it for a certain date you could do this

<?php

\$date1 = mktime (0,0,0,date("8") ,date("4")-5,date("2004"));
\$date = date("Y-d-m", \$date1);

echo "\$date";

?>
0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.