时间

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

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

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

前一天的日期为:

date("Y-m-d",strtotime("-1 days",strtotime('2019-08-31')))

 

前一月的日期为

date("Y-m-d",strtotime("-1 months",strtotime('2019-08-31')))

 

前一年的日期为:

date("Y-m-d",strtotime("-1 years",strtotime('2019-08-31')))

 

后一天的日期为:

date("Y-m-d",strtotime("+1 days",strtotime('2019-08-31')))

 

后一月的日期为:

date("Y-m-d",strtotime("+1 months",strtotime('2019-08-31')))

 

后一年的日期为:

date("Y-m-d",strtotime("+1 years",strtotime('2019-08-31')))

 

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

本文属原创,转载请注明原文:https://www.zhimatong.com/jiaocheng/254.html

为保证教程的实用性及扩大知识面覆盖,如果您有相似问题而未解决,可联系在线客服免费技术支持。

内容有用

联系
顾问

交流群 购物车
账号登录

没有账号?立即注册

忘记密码

登录即同意用户协议没有账号? 立即注册
账号注册
我已阅读并同意用户协议
立即注册
注册即同意用户协议已有账号? 立即登录
找回密码

操作步骤:邮箱验证->设置新密码

注册即同意用户协议已有账号? 立即登录