(self: DateTime): UtcConverts a DateTime to a UTC DateTime.
When to use
Use to represent the same instant in UTC instead of its current time zone.
Details
The returned value keeps the same epoch milliseconds and changes only the
DateTime representation to UTC.
Example (Converting DateTime values to UTC)
import { DateTime } from "effect"
const now = DateTime.makeZonedUnsafe({ year: 2024 }, {
timeZone: "Europe/London"
})
// set as UTC
const utc: DateTime.Utc = DateTime.toUtc(now)export const const toUtc: (self: DateTime) => UtcConverts a DateTime to a UTC DateTime.
When to use
Use to represent the same instant in UTC instead of its current time zone.
Details
The returned value keeps the same epoch milliseconds and changes only the
DateTime representation to UTC.
Example (Converting DateTime values to UTC)
import { DateTime } from "effect"
const now = DateTime.makeZonedUnsafe({ year: 2024 }, {
timeZone: "Europe/London"
})
// set as UTC
const utc: DateTime.Utc = DateTime.toUtc(now)
toUtc: (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) => Utc = import InternalInternal.const toUtc: (
self: DateTime.DateTime
) => DateTime.Utc
toUtc