(PHP 4, PHP 5)
localtime вЂ” Get the local time
The localtime() function returns an array identical to that of the structure returned by the C function call.
The optional timestamp parameter is an integer Unix timestamp that defaults to the current local time if a timestamp is not given. In other words, it defaults to the value of time().
If set to FALSE or not supplied than the array is returned as a regular, numerically indexed array. If the argument is set to TRUE then localtime() is an associative array containing all the different elements of the structure returned by the C function call to localtime. The names of the different keys of the associative array are as follows:
Every call to a date/time function will generate a E_NOTICE if the time zone is not valid, and/or a E_STRICT message if using the system settings or the TZ environment variable. See also date_default_timezone_set()
Now issues the E_STRICT and E_NOTICE time zone errors.
Example#1 localtime() example
$localtime = localtime();
$localtime_assoc = localtime(time(), true);
The above example will output something similar to:
Array (  => 24  => 3  => 19  => 3  => 3  => 105  => 0  => 92  => 1 ) Array ( [tm_sec] => 24 [tm_min] => 3 [tm_hour] => 19 [tm_mday] => 3 [tm_mon] => 3 [tm_year] => 105 [tm_wday] => 0 [tm_yday] => 92 [tm_isdst] => 1 )