Get date of tomorrow, day after, yesterday, day before - PHP

How to get the date of tomorrow and day after, yesterday and day before in standard format ? What PHP function should I use to get these values ?
13 Mar 2020 at 01:45 PM
0pnshow more
onefiveonefive
Hi,

Simple method how to get the date of tomorrow, yesterday, etc. is to use:

$tomorrow = date( "Ymd", strtotime( "+1 days" ) );
$dayaftertomorrow = date( "Ymd", strtotime( "+2 days" ) );
$yesterday = date( "Ymd", strtotime( "-1 days" ) );
$daybeforeyesterday = date( "Ymd", strtotime( "-2 days" ) );

The date format can be modified, so you should get what you need.
17 Mar 2020 at 03:36 PM
0pnshow more
TimTim
Share on FacebookShare on TwitterShare on LinkedInSend email
2021 AnswerTabsTermsContact us