将月日年添加到PHP date()

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将月日年添加到PHP date()相关的知识,希望对你有一定的参考价值。

  1. $date = date("Y-m-d");
  2. $date = strtotime(date("Y-m-d", strtotime($date)) . " +12 month");
  3. $date = date("Y-m-d",$date);
  4. echo $date;
  5.  
  6. Other examples
  7. $date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");
  8. $date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");
  9. $date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week");
  10. $date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
  11. $date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days");

以上是关于将月日年添加到PHP date()的主要内容,如果未能解决你的问题,请参考以下文章