开发者

PHP multiple values in strtotime do not work together

I am trying to get multiple values is strtotime to work together but they will not so I may be missing something or in need of a work around.

For exa开发者_StackOverflow中文版mple

<?php echo date('Y-m-d', strtotime('+2 month first saturday'));?>

In this example you will get the date in 2 months but the day of week will be consistent with the day of week for this saturday not saturday in 2 months.

EDIT

This code from BUTTERBROT strtotime("first saturday", strtotime("+2 month")); solves the immeidiate problem however now when it looks for the first saturday in APRIL and JULY of this year it displays the 9th instead of the 2nd. Does anyone know why and how to stop it.


strtotime takes a secound argument as optional timestamp, maybe you can chain the function so they get called in the correct order:

strtotime("first saturday", strtotime("+2 month"));


"first saturday +2 months" works for me

edit: I think your problem is you use "month" instead of "months"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜