Shahriar Kabir
Shahriar Kabir

Reputation: 284

How do I get the next day of the week?

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 :(.

Upvotes: 4

Views: 858

Answers (2)

Muatik
Muatik

Reputation: 4171

The following expression gives you the next day:

date('l', time()+3600*24)

Upvotes: 0

Will Vousden
Will Vousden

Reputation: 33348

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'))

Upvotes: 10

Related Questions