设为首页 加入收藏

TOP

php获取指定日期的前一天,前一月,前一年日期
2019-09-04 00:57:12 】 浏览:51
Tags: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就可以了。

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇有些需要禁用的PHP危险函数(disab.. 下一篇[MySQL] mysql地理位置服务geomet..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目