I am feeling a bit thick today and maybe a little tired..
I am trying to add days on to a string date…
$startdate = "18/7/2011";
$enddate = date(strtotime($startdate) . " +1 day");
echo $startdate;
echo $enddate;
My heads not with it… where am i going wrong ?
Thanks
Lee
Either
or
should work. However, neither is working with the
18/7/2011date. They work fine with7/18/2011: http://codepad.viper-7.com/IDS0gI . Might be some localization problem.In the first way, using the second parameter to
strtotimesays to add one day relative to that date. In the second way,strtotimefigures everything out. But apparently only if the date is in the USA’s date format, or in the other format using dashes: http://codepad.viper-7.com/SKJ49r