Link to home
Create AccountLog in
Avatar of newbe101
newbe101

asked on

php mysql add days to date variable

trying to add a number of days variable to a date variable... here is what I have so far (not working):

$newDate = strtotme("+$days_to_add day", $existing_date());
echo "<br>Days added: $days_to_add";
echo "<br>New date: $newDate<br>";
Avatar of hernst42
hernst42
Flag of Germany image

What is the content of $existing_date?

should lokk like this:
$newDate = strtotime("+$days_to_add day", $existing_date);
echo "<br>Days added: $days_to_add";
echo "<br>New date: $newDate<br>";
Avatar of newbe101
newbe101

ASKER

$existing_date is a date pulled from my mysql database (0000-00-00).
here is my echo results:
Days added: 60 to 2008-06-08
New date: 5186008
I don't know why new date looks like that... shouldn't it be in the 0000-00-00 format?
ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
perfect... thanks again!