array localtime ( [int $timestamp [, bool $is_associative]] );
localtime()函数返回一个数组,该数组与C函数调用返回的结构的数组相同。
Sr.No | Parameter & Description |
---|---|
1 |
timestamp(可选) 这是一个整数Unix时间戳,如果没有给定时间戳,则默认为当前本地时间。换句话说,它默认为time()的值。 |
2 |
is_Associative(可选) 如果设置为false或未提供,则数组将作为常规的数字索引数组返回。如果参数设置为true,那么localtime()是一个关联数组,包含C函数调用localtime返回的结构的所有不同元素。 关联数组的不同键的名称如下所示:- 链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-localtime.html 来源:LearnFk无涯教程网
|
<?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 )
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)