I have such a line - the current date + 7 days:
$ nextweek = date (mktime (date ("m"), date ("d") + 7, date ("Y")));
It is necessary to translate the result in the form '2016-02-19' How to do it?
I have such a line - the current date + 7 days:
$ nextweek = date (mktime (date ("m"), date ("d") + 7, date ("Y")));
It is necessary to translate the result in the form '2016-02-19' How to do it?
The current date is 7 days shorter to receive so:
date("Ymd",time()+7*24*60*60);
Using mktime like this:
date("Ymd",mktime(0,0,0,date("m") , date("d")+7, date("Y")));
The first parameter is the format, the second is your date. date('Ym-d', $date);
Source: https://ru.stackoverflow.com/questions/491768/
All Articles