Reputation: 1510
To get the numerical representation of the 7 day week you do this :
echo date('N'); // 2 (Tuesday)
Is there a built in function to get tomorrow's numerical day?
I know how I could do it programatically, but I was wondering if there was a function to do this?
Upvotes: 1
Views: 853
Reputation: 42384
You can use DateTime()
and modify()
to +1 day
:
$datetime = new DateTime();
$datetime->modify('+1 day');
echo $datetime->format('N');
Or alternatively just set the modification in DateTime()
directly:
$datetime = new DateTime('+1 day');
echo $datetime->format('N');
Other relative date statements are available as well, such as tomorrow
. These are detailed on the Supported Date and Time Formats: Relative Formats manual page.
Upvotes: 5