Karthik Malla
Karthik Malla

Reputation: 5800

Convert Day to Next Available Date in PHP

how can I convert the day to the near future date in php?

Like if I enter Monday and if today is Friday 22/08/2014 it should convert Monday to 25/08/2014 ?

Upvotes: 0

Views: 43

Answers (1)

ins0
ins0

Reputation: 3928

use the php function strtotime and the key next week monday to get the next date

https://www.php.net/manual/de/function.strtotime.php

$theDay = 'Monday'; // eg. Monday
$time = strtotime('next week ' . $theDay);
echo date('d.m.y', $time); // get next monday

Upvotes: 2

Related Questions