Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the next day of the week?

Tags:

date

php

Like if today is Thursday, then I want to display Friday using php date() function. For example, the below code will show the current month but the next day of the month. It worked. <?php echo date("M "), date("d")+1 ?>

So I was trying through this one <?php echo date("l")+1, date("d")+1 ?> and it fooled me :(.

like image 938
Shahriar Kabir Avatar asked Dec 27 '22 13:12

Shahriar Kabir


1 Answers

Have a look at strtotime. Also, an l will produce a full textual representation of the day of the week (e.g. Friday) when using date.

Something like the following should do what you want:

date('l', strtotime('+1 day'))
like image 72
Will Vousden Avatar answered Jan 09 '23 08:01

Will Vousden