PHP中如何给日期加上一个月/天
2024-10-19 02:23:23
使用php的strtotime
实例:比如现在时间是“2017-07-06”,加一个月。
echo date("Y-m-d", strtotime("+1 months", strtotime("2017-07-06")));
<?php
echo(strtotime("now"));
echo(strtotime("3 October 2005"));
echo(strtotime("+5 hours"));
echo(strtotime("+1 week"));
echo(strtotime("+1 week 3 days 7 hours 5 seconds"));
echo(strtotime("next Monday"));
echo(strtotime("last Sunday"));
?>
print_r(date('Y-m-d H:i:s',strtotime("+1 month")));
最新文章
- SQL Server2016升级前几点自检
- UEditor独立图片、文件上传模块
- Dancing Link --- 模板题 HUST 1017 - Exact cover
- [Swift]枚举
- SCOM随笔
- js字符串倒序
- HDOJ(HDU) 1718 Rank(水题、、、)
- 2014.9.3数据库CRUD
- hibernate---一对一双向外键关联 (重要)
- Implement a Linked List
- 在Winform混合式框架中整合外部API接口的调用
- python学习之路web框架
- SSRS----关于图表参考线(平均线)的添加
- Annotation 的第一个工程
- HTML5 - Canvas【申明:来源于网络】
- Python高级网络编程系列之第三篇
- 17. Letter Combinations of a Phone Number(bfs)
- for循环跳转语句(break、continue)
- Linux学习笔记:Shell脚本学习
- NPM和Yarn添加淘宝镜像