localtime() returns an array containing the time components of a Unix timestamp. It returns an array identical to that of the structure returned by the C function call.
Syntax of localtime() Function PHP
Parameter & Description of localtime() Function PHP
timestamp - timestamp is optional parameter. It specifies the date or time to be formatted, it returns the local time if it is not formatted.
is_associative - is_associative is optional that specifies whether to return an associative or indexed array. If set to false the array returned is an indexed array. If set to true then the array returned is an associative array.
The keys of the associative array are:
Example: Example without and with associative arrays:
echo("<br /><br />");
The output of the code above could be:
 => 15
 => 23
 => 09
 => 14
 => 12
 => 115
 => 5
 => 17
 => 4
[tm_sec] => 15
[tm_min] => 23
[tm_hour] => 09
[tm_mday] => 14
[tm_mon] => 12
[tm_year] => 115
[tm_wday] => 5
[tm_yday] => 17
[tm_isdst] => 4
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.