Easy Tutorial
❮ Php Functions Func Filesystem Fpassthru ❯

PHP localtime() Function

PHP Date/Time Reference Manual

Example

Output the local time as a numeric array and an associative array:


Definition and Usage

The localtime() function returns the local time.

Syntax

Parameter Description
timestamp Optional. Specifies the Unix timestamp. If the timestamp is not specified, it defaults to the current local time from time().
is_assoc Optional. Specifies whether to return an associative array or a numeric array. If FALSE, it returns a numeric array. If TRUE, it returns an associative array. The default is FALSE. The keys of the associative array are as follows: [tm_sec] - seconds<br> [tm_min] - minutes<br> [tm_hour] - hours<br> [tm_mday] - day of the month<br> [tm_mon] - month of the year, starting from 0 for January<br> [tm_year] - years since 1900<br> [tm_wday] - day of the week (Sunday=0)<br> [tm_yday] - day of the year<br> [tm_isdst] - whether daylight saving time is in effect

Technical Details

Return Value: Returns an array containing the components of the Unix timestamp.
PHP Version: 4+
--- ---
Changelog: PHP 5.1.0: Added E_STRICT and E_NOTICE timezone errors. <br>
--- ---

❮ Php Functions Func Filesystem Fpassthru ❯