简体   繁体   中英

PHP get next wednesday of a specific date

$wed_date = strtotime('next wednesday');

$my_time = $some_unix_time; 

//how do I get this line below to work
$the_next_wednesday_from_my_time = "";

eg I want to know from a unix time, the next wednesday is when, how do I achieve it :)

Thanks for helping

Try this:

$currentDate   = time();
$nextWednesday = strtotime('next wednesday', $currentDate);

echo date('d-m-Y', $nextWednesday);

strtotime takes a second parameter which is the starting time. See https://php.net/manual/ro/function.strtotime.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM