(self: DateTime): stringFormats a DateTime as a UTC ISO string.
Details
Always returns the UTC representation in ISO 8601 format, ignoring any time zone.
Example (Formatting DateTime values as ISO strings)
import { DateTime } from "effect"
const dt = DateTime.makeUnsafe("2024-01-01T12:30:45.123Z")
console.log(DateTime.formatIso(dt)) // "2024-01-01T12:30:45.123Z"
const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:30:45.123Z", {
timeZone: "Europe/London"
})
console.log(DateTime.formatIso(zoned)) // "2024-01-01T12:30:45.123Z"formatting
Source effect/DateTime.ts:26931 lines
export const const formatIso: (
self: DateTime
) => string
Formats a DateTime as a UTC ISO string.
Details
Always returns the UTC representation in ISO 8601 format, ignoring any time zone.
Example (Formatting DateTime values as ISO strings)
import { DateTime } from "effect"
const dt = DateTime.makeUnsafe("2024-01-01T12:30:45.123Z")
console.log(DateTime.formatIso(dt)) // "2024-01-01T12:30:45.123Z"
const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:30:45.123Z", {
timeZone: "Europe/London"
})
console.log(DateTime.formatIso(zoned)) // "2024-01-01T12:30:45.123Z"
formatIso: (self: DateTimeself: type DateTime = Utc | ZonedA DateTime represents a point in time. It can optionally have a time zone
associated with it.
Companion namespace containing the public helper types used by DateTime
constructors, parts APIs, formatting, and date/time arithmetic.
DateTime) => string = import InternalInternal.const formatIso: (
self: DateTime.DateTime
) => string
formatIsoReferenced by 1 symbols