PHP date_sub() 函数
PHP 教程
· 2019-01-23 22:13:53
实例
从 2013 年 3 月 15 日减去 40 天:
<?php
$date=date_create("2013-03-15");
date_sub($date,date_interval_create_from_date_string("40 days"));
echo date_format($date,"Y-m-d");
?>
$date=date_create("2013-03-15");
date_sub($date,date_interval_create_from_date_string("40 days"));
echo date_format($date,"Y-m-d");
?>
定义和用法
date_sub() 函数从指定日期减去日、月、年、时、分和秒。
语法
date_sub(object,interval);
| 参数 | 描述 |
|---|---|
| object | 必需。规定一个由 date_create() 返回的 DateTime 对象。 |
| interval | 必需。规定一个 DateInterval 对象。 |
技术细节
| 返回值: | 如果成功则返回 DateTime 对象,如果失败则返回 FALSE。 |
|---|---|
| PHP 版本: | 5.3+ |
点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html
The Dream Machine
M. Mitchell Waldrop / Penguin Books / 2002-8 / USD 16.00
While most people may not be familiar with the name J. C. R. Licklider, he was the guiding spirit behind the greatest revolution of the modern era. At a time when most computers were big, ponderous ma......一起来看看 《The Dream Machine》 这本书的介绍吧!
CSS 压缩/解压工具
在线压缩/解压 CSS 代码
JSON 在线解析
在线 JSON 格式化工具