Definition :
In php localtime() Function is inbuilt function.PHP localtime() function is used to return the local time. It accepts two parameters $timestamp and $is_associative. It returns an array containing the components of a Unix timestamp.
localtime(timestamp, is_assoc)
Parameter | Description |
---|---|
timestamp | Optional. Specifies a Unix timestamp that defaults to the current local time, time(), if no timestamp is specified |
is_assoc | Optional. Specifies whether to return an associative or indexed array. FALSE = the array returned is an indexed array. TRUE = the array returned is an associative array. FALSE is default.
The keys of the associative array are:
|
Given below example print local time as an indexed and as an associative array:
Output :