Is there a way to add a certain number of days to a date formatted like 2010-10-17 without converting it to a unix timestamp lik开发者_如何学运维e using the function strtotime in php?
You can play around with the DateTime library.
So, based on your description, something like the following should do the trick:
$date = new DateTime('2010-10-17');
$date->add(new DateInterval('P10D')); //adding ten days
echo $date->format('Y-m-d') . "\n";
Outputs: 2010-10-27
Although I'm curious as to why you do not want to work with timestamps? As they're the most flexible choice here.
精彩评论