Paramjeet
Paramjeet

Reputation: 316

Get date for a specific day which is after today's date

If I have date like 22-11-2016(d-m-Y) and the day is Saturday for whom I have to search the date and it would be 26-11-2016(d-m-Y). So How to get it?

Upvotes: 0

Views: 686

Answers (2)

TIGER
TIGER

Reputation: 2905

If you want to get next week day's date then might be this can help you.

date('d-m-Y', strtotime('next saturday'));

Or also you can use PHP date object as below.

// Create a new DateTime object
$date = new DateTime('22-11-2016');

// Modify the date it contains
$date->modify('next saturday');

// Output
echo $date->format('d-m-Y');

Upvotes: 5

Blinkydamo
Blinkydamo

Reputation: 1584

Here you going, using DateTime you could do this.

$date = new DateTime( '22-11-2016' );
$date = $date->modify( 'next saturday' );
echo $date->format( 'd-m-Y' );

Upvotes: 0

Related Questions