大网数据广告活动
Web 标准与前端开发

Temporal.Now.plainTimeISO()

· 52CE 我爱测

The **`Temporal.Now.plainTimeISO()`** static method returns the current time as a Temporal.PlainTime object, in the specified time zone.

The Temporal.Now.plainTimeISO() static method returns the current time as a Temporal.PlainTime object, in the specified time zone.

Note that although the method contains "ISO" in its name, Temporal.PlainTime objects do not have associated calendars, as the time format is not calendar-dependent.

Syntax

Temporal.Now.plainTimeISO()
Temporal.Now.plainTimeISO(timeZone)

Parameters

  • timeZone
    • : Either a string or a Temporal.ZonedDateTime instance representing the time zone to interpret the system time in. If a Temporal.ZonedDateTime instance, its time zone is used. If a string, it can be a named time zone identifier, an offset time zone identifier, or a date-time string containing a time zone identifier or an offset (see time zones and offsets for more information).

Return value

The current time in the specified time zone, as a Temporal.PlainTime object. Has the same precision as Temporal/Now/instant.

Exceptions

  • RangeError
    • : Thrown if the time zone is invalid.

Examples

Using Temporal.Now.plainTimeISO()

// The current time in the system's time zone
const time = Temporal.Now.plainTimeISO();
console.log(time); // e.g.: 06:12:34.567890123

// The current time in the "America/New_York" time zone
const timeInNewYork = Temporal.Now.plainTimeISO("America/New_York");
console.log(timeInNewYork); // e.g.: 23:12:34.567890123

Specifications

Browser compatibility

See also

  • Temporal.Now
  • Temporal.PlainTime

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

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

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