echo date("Y-m-d",strtotime("-1 month",strtotime("2019-7-31")));
//2017-07-01
//为什么输出不是6.31呢,因为6月没有31,-1 month变成6.31后其实是7.1号。

echo date("Y-m-d",strtotime("last day of -1 month",strtotime("2019-7-31"))); //2017-06-30
echo date("Y-m-d",strtotime("first day of -1 month",strtotime("2019-7-31"))); //2017-06-01

  

相关文章:

  • 2022-01-04
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2021-08-12
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案