Hyperlinkv0.8.0-beta.28

DateTime

DateTime.toPartsUtcconsteffect/DateTime.ts:1743
(self: DateTime): DateTime.PartsWithWeekday

Gets the UTC parts of a DateTime as an object.

Details

The parts will always be in UTC, ignoring any time zone information.

Example (Reading UTC DateTime parts)

import { DateTime } from "effect"

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

console.log(parts)
// Always returns UTC parts regardless of time zone
parts
export const toPartsUtc: (self: DateTime) => DateTime.PartsWithWeekday = Internal.toPartsUtc