Temporal.Now.plainTimeISO()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
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
Optional-
Either a string or a
Temporal.ZonedDateTime
instance representing the time zone to interpret the system time in. If aTemporal.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
Specification |
---|
Temporal proposal # sec-temporal.now.plaintimeiso |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
plainTimeISO |
Legend
Tip: you can click/tap on a cell for more information.
- No support
- No support
- Experimental. Expect behavior to change in the future.
- See implementation notes.
- User must explicitly enable this feature.