PHP Select every other Wednesday

前端 未结 4 1732
天命终不由人
天命终不由人 2021-01-27 01:18

I need help Select every other Wednesday starting on 5/2/12. This code below selects every other Wednesday starting on the week it currently is. But i need to set the beginning

4条回答
  •  离开以前
    2021-01-27 02:19

    If you have PHP 5.2.0 or newer, you can do it easily this way:

    $date = new DateTime('2006-05-02');
    for ($i=0; $i<10; $i++) {
       echo $date->format('m-d-Y').'
    '.PHP_EOL; $date->modify('+1 week'); }

提交回复
热议问题