设置时间:
<?php
$date=date_create("2013-05-01");
date_time_set($date,13,24);
echo date_format($date,"Y-m-d H:i:s");
?>
亲自试一试 »
date_time_set() 函数设置时间。
date_time_set(
object, hour, minute, second, microseconds)
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create() |
hour | Required. Specifies the hour of the time |
minute | Required. Specifies the minute of the time |
second | Optional. Specifies the second of the time. Default is 0 |
microseconds | Optional. Specifies the microsecond of the time. Default is 0 |
返回值: | 成功时返回 DateTime 对象。失败时为 FALSE |
---|---|
PHP 版本: | 5.2+ |
PHP 变更日志: | PHP 7.1:添加微秒范围 PHP 5.3:将返回值从 NULL 更改为 DateTime |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!