Hyperlinkv0.8.0-beta.28

DateTime

DateTime.zonedOffsetconsteffect/DateTime.ts:1608
(self: Zoned): number

Computes the time zone offset of a DateTime.Zoned in milliseconds.

Details

Returns the offset from UTC in milliseconds. Positive values indicate time zones ahead of UTC, negative values indicate time zones behind UTC.

Example (Reading zoned offsets)

import { DateTime } from "effect"

const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
  timeZone: "Europe/London"
})

const offset = DateTime.zonedOffset(zoned)
console.log(offset) // 0 (London is UTC+0 in winter)
converting
export const zonedOffset: (self: Zoned) => number = Internal.zonedOffset