PHP date_timestamp_set () function
PHP Date / Time Reference Manual
Examples
Setting the date and time based on Unix timestamp:
<?php
$date=date_create();
date_timestamp_set($date,1371803321);
echo date_format($date,"U = Y-m-d H:i:s");
?>
$date=date_create();
date_timestamp_set($date,1371803321);
echo date_format($date,"U = Y-m-d H:i:s");
?>
Running instance »
Definition and Usage
date_timestamp_set () function to set the date and time based on a Unix timestamp.
grammar
date_timestamp_set( object,unixtimestamp);
参数 | 描述 |
---|---|
object | 必需。规定一个由 date_create() 返回的 DateTime 对象。该函数修改该对象。 |
unixtimestamp | 必需。规定代表日期的 Unix 时间戳。 |
technical details
return value: | Returns the specified format DateTime object. If it fails it returns FALSE. |
---|---|
PHP version: | 5.3+ |
PHP Date / Time Reference Manual