docs.rodeo

MDN Web Docs mirror

Temporal.PlainDateTime

{{JSRef}} {{SeeCompatTable}} 

The Temporal.PlainDateTime object represents a date (calendar date) and time (wall-clock time) without a time zone. It is fundamentally represented as a combination of a date (with an associated calendar system) and a time.

Description

A PlainDateTime is essentially the combination of a {{jsxref("Temporal.PlainDate")}}  and a {{jsxref("Temporal.PlainTime")}} . Because the date and time information don’t have much interaction, all general information about date properties is documented in the PlainDate object, and all general information about time properties is documented in the PlainTime object.

If the date-time represents a specific instant that should remain invariant across time zones, you should use the {{jsxref("Temporal.ZonedDateTime")}}  object instead. Use PlainDateTime when you need to represent an event happening at a specific wall-clock time that may be a different instant in different time zones.

RFC 9557 format

PlainDateTime objects can be serialized and parsed using the RFC 9557 format, an extension to the ISO 8601 / RFC 3339 format. The string has the following form (spaces are only for readability and should not be present in the actual string):

YYYY-MM-DD T HH:mm:ss.sssssssss [u-ca=calendar_id]

As an input, you may optionally include the offset and time zone identifier, in the same format as ZonedDateTime, but they will be ignored. Note that the offset must not be Z. Other annotations in the [key=value] format are also ignored, and they must not have the critical flag.

When serializing, you can configure the fractional second digits, whether to display the calendar ID, and whether to add a critical flag for it.

Constructor

Static methods

Instance properties

These properties are defined on Temporal.PlainDateTime.prototype and shared by all Temporal.PlainDateTime instances.

Instance methods

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN