PHP localtime () function
PHP Date / Time Reference Manual
Examples
In the form of a numeric array and an associative array output Local Time:
<?php
print_r(localtime());
echo "<br><br>";
print_r(localtime(time(),true));
?>
print_r(localtime());
echo "<br><br>";
print_r(localtime(time(),true));
?>
Running instance »
Definition and Usage
localtime () function returns the local time.
grammar
localtime( timestamp,is_assoc);
参数 | 描述 |
---|---|
timestamp | 可选。规定 Unix 时间戳。如果未规定 timestamp ,则默认为当前的本地时间 time()。 |
is_assoc | 可选。规定返回关联数组还是数值数组。如果为 FALSE,则返回数值数组。如果为 TRUE,则返回关联数组。默认为 FALSE。
关联数组的键名如下所示:
|
technical details
return value: | It returns an array Unix timestamp component. |
---|---|
PHP version: | 4+ |
Update log: | PHP 5.1.0: increase E_STRICT and E_NOTICE time zone errors. |
PHP Date / Time Reference Manual