如何停止30/31天的DateTime和date_diff刷新

时间:2019-07-03 19:14:32

标签: php datetime

以下代码有问题,我需要它来计数30/31天,但是当计数到31天时,它又回到1

      $startDate = new DateTime();
      $endDate = new DateTime($row['vadded']);
      $diff = date_diff($endDate,$startDate);

这是输出

      <td><?php echo $diff->format('%d days')?></td>

0 个答案:

没有答案