date calculation

can someone tell me how to add the current date with a digit?
Example:

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

thank you!!!
spacelife23Asked:
Who is Participating?
 
Marcus BointonConnect With a Mentor Commented:
$newdate = date('Y-m-d', strtotime('+5 day', strtotime('2004-08-30')));
0
 
UmeshMySQL Principle Technical Support EngineerCommented:
0
 
Marcus BointonCommented:
Be warned - That's an old article that doesn't cover the wonders of strtotime, instead writing reams of code that does less.
0
 
jmsloanCommented:
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
 
jmsloanCommented:
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
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.

All Courses

From novice to tech pro — start learning today.