Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the date of one week from today

Tags:

date

php

How do I get the date, one week from today, in the following format: YYYY-MM-DD ?

like image 424
santa Avatar asked Apr 11 '11 23:04

santa


People also ask

How can I get current date from next week in PHP?

just used it - date('Y-m-d H:i:s', strtotime('+1 week')); works fine in PHP 7 to give one week from now.

How do you find the date of a day of the week from a date using PHP?

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; ?>


1 Answers

Try:

date("Y-m-d", strtotime("+1 week")); 

This will output:

2015-12-31 

If today is 2015-12-24

like image 178
Joel Avatar answered Sep 28 '22 19:09

Joel