目录

PHP gettimeofday() 函数

❮ PHP 日期/时间参考

示例

返回当前时间:

<?php
// Print the array from gettimeofday()
print_r(gettimeofday());

// Print the float from gettimeofday()
echo gettimeofday(true);
?>
亲自试一试 »

定义和用法

gettimeofday() 函数返回当前时间。


语法

gettimeofday( return_float)

参数值

Parameter Description
return_float Optional. When set to TRUE, a float instead of an array is returned. Default is FALSE

技术细节

返回值: 默认返回一个关联数组,具有以下数组键:
  • [sec] - 自 Unix 纪元以来的秒数
  • [usec] - 微秒
  • [分钟西] - 格林威治以西分钟
  • [dsttime] - 夏令时校正的类型
如果返回浮动参数设置为true,返回一个float
PHP 版本: 4+
变更日志: PHP 5.1.0:添加了返回浮动范围

❮ PHP 日期/时间参考