(PHP 4, PHP 5, PHP 7)
localtime — Get the local time
$timestamp = time()
[, bool $is_associative = false
]] )The localtime() function returns an array identical to that of the structure returned by the C function call.
timestamp선택적인
timestamp 인수는 timestamp가
주어지지 않았을 경우, 현재 로컬 시간을 기본값으로 가지는
integer 유닉스 타임스탬프입니다. 즉, 기본값은
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:
모든 날짜/시간 함수 호출은
시간대가 유효하지 않을 때 E_NOTICE를, 시스템 설정이나
TZ 환경 변수를 사용할 때 E_STRICT나
E_WARNING 메세지를
생성합니다. date_default_timezone_set()을
참고하십시오.
| 버전 | 설명 |
|---|---|
| 5.1.0 | 시간대 오류시
|
Example #1 localtime() example
<?php
$localtime = localtime();
$localtime_assoc = localtime(time(), true);
print_r($localtime);
print_r($localtime_assoc);
?>
위 예제의 출력 예시:
Array
(
[0] => 24
[1] => 3
[2] => 19
[3] => 3
[4] => 3
[5] => 105
[6] => 0
[7] => 92
[8] => 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
)