How do I get the date, one week from today, in the following format: YYYY-MM-DD ?
just used it - date('Y-m-d H:i:s', strtotime('+1 week')); works fine in PHP 7 to give one week from now.
php $day=5; $w = date("w", strtotime("2011-01-11")) + 1; // you must add 1 to for Sunday echo $w; $sunday = date("Y-m-d", strtotime("2011-01-11")-strtotime("+$w day")); $result = date("Y-m-d", strtotime($sunday)+strtotime("+$day day")); echo $result; ?>
Try:
date("Y-m-d", strtotime("+1 week"));
This will output:
2015-12-31
If today is 2015-12-24
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With