## php获取指定日期的前一天,前一月,前一年日期
 

前一天的日期为:

date("Y-m-d",strtotime("-1 days",strtotime('2014-07-01')))

前一月的日期为:

date("Y-m-d",strtotime("-1 months",strtotime('2014-07-01')))

前一年的日期为:

date("Y-m-d",strtotime("-1 years",strtotime('2014-07-01')))

 

后一天的日期为:

date("Y-m-d",strtotime("+1 days",strtotime('2014-07-01')))

后一月的日期为:

date("Y-m-d",strtotime("+1 months",strtotime('2014-07-01')))

后一年的日期为:

date("Y-m-d",strtotime("+1 years",strtotime('2014-07-01')))

如果不是1,就把+1或者-1换成+n或者-n就可以了。

相关文章:

  • 2021-12-29
  • 2021-11-29
  • 2022-12-23
  • 2022-02-04
  • 2021-08-28
  • 2021-11-28
  • 2021-12-18
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-01-06
相关资源
相似解决方案