PHP localtime()関数
例
現地時間をインデックス付きおよび連想配列として出力します。
<?php
print_r(localtime());
echo "<br><br>";
print_r(localtime(time(),true));
?>
定義と使用法
localtime()関数は、現地時間を返します。
構文
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:
|
技術的な詳細
戻り値: | Unixタイムスタンプのコンポーネントを含む配列を返します |
---|---|
PHPバージョン: | 4歳以上 |
PHP変更ログ: | PHP 5.1:E_STRICTおよびE_NOTICEタイムゾーンエラーを発行するようになりました |
❮PHPの日付/時刻リファレンス