简体   繁体   中英

How To Get Next Wednesday With PHP?

I have this situation :

17 January 2017 is Tuesday.

I'm expecting my code will generate 25 January 2017 as NEXT Wednesday. Not 18 January 2017.

19 January 2017 is Thursday.

I'm expecting my code will generate 25 January 2017 as NEXT Wednesday too.

but this code :

$payment_date = '17 January 2017';
echo $payment_date . '<br>';

$payment_date = date('d M Y', strtotime('next Wednesday', strtotime($payment_date)));
echo $payment_date;

gives me 18 January 2017 as next Wednesday. how to get 25 January 2017 as next Wednesday when my code runs between 15 - 21 January 2017?

thank you

$payment_date = date('d M Y', strtotime('next wednesday next week', strtotime($payment_date)));

尝试使用+1 week Wednesday而不是Next Wednesday

$payment_date = date('d M Y', strtotime('+1 week Wednesday', strtotime($payment_date)));

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