PHP localtime() Function
Example
Output local time in the form of numeric arrays and associative arrays:
<?php print_r(localtime()); echo "<br><br>"; print_r(localtime(time(),true)); ?>
Definition and Usage
The localtime() function returns local time.
Syntax
localtime(timestamp,is_assoc);
Parameter | Description |
---|---|
timestamp | Optional. Specifies Unix timestamp. If not specified timestampthen the default is the current local time time(). |
is_assoc |
Optional. Specifies whether to return an associative array or an indexed array. If FALSE, an indexed array is returned. If TRUE, an associative array is returned. The default is FALSE. The key names of the associated arrays are as follows:
|
Technical Details
Return Value: | Returns an array containing Unix timestamp components. |
---|---|
PHP Version: | 4+ |
Update Log: | PHP 5.1.0: Added E_STRICT and E_NOTICE timezone errors. |