大网数据广告活动
PHP 语言与运行手册

IntlCalendar::getTime · Get time currently represented by the object

· 52CE 我爱测

(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)

IntlCalendar::getTime

(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)

IntlCalendar::getTime — Get time currently represented by the object

说明

面向对象风格

public function IntlCalendar::getTime(): float|false

过程化风格

function intlcal_get_time(IntlCalendar $calendar): float|false

Returns the time associated with this object, expressed as the number of milliseconds since the epoch.

参数

calendar

IntlCalendar 实例。

返回值

A float representing the number of milliseconds elapsed since the reference time (1 Jan 1970 00:00:00 UTC), 或者在失败时返回 false

示例

示例 #1 IntlCalendar::getTime()

<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'en_US');

$cal = new IntlGregorianCalendar(2013, 4 /* May */, 1, 0, 0, 0);
$time = $cal->getTime();
var_dump($time, $time / 1000 == strtotime('2013-05-01 00:00:00')); //true

以上示例会输出:

float(1367362800000)
bool(true)

参见

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。