Menu Riverview Church

LOCALTIME

Get the local time

SYNTAX

localtime ([ int $timestamp = time() [, bool $is_associative = FALSE ]] ) : array

PARAMETERS

timestamp

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().

is_associative

If set to FALSE or not supplied then the array is returned as a regular, numerically indexed array. If the argument is set to TRUE then localtime() returns 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:

"tm_sec" seconds, 0 to 59
"tm_min" minutes, 0 to 59
"tm_hour" hours, 0 to 23
"tm_mday" day of the month, 1 to 31
"tm_mon" month of the year, 0 (Jan) to 11 (Dec)
"tm_year" years since 1900
"tm_wday" day of the week, 0 (Sun) to 6 (Sat)
"tm_yday" day of the year, 0 to 365
"tm_isdst" is daylight savings time in effect? Positive if yes, 0 if not, negative if unknown.

RETURN

EXAMPLES

Array
(
    [0] => 17
    [1] => 58
    [2] => 10
    [3] => 28
    [4] => 9
    [5] => 120
    [6] => 3
    [7] => 301
    [8] => 0
)
Array
(
    [tm_sec] => 17
    [tm_min] => 58
    [tm_hour] => 10
    [tm_mday] => 28
    [tm_mon] => 9
    [tm_year] => 120
    [tm_wday] => 3
    [tm_yday] => 301
    [tm_isdst] => 0
)

PHP