Hyperlinkv0.8.0-beta.28

DateTime

DateTime.toDateUtcconsteffect/DateTime.ts:1555
(self: DateTime): Date

Gets the UTC Date of a DateTime.

Details

This always returns the UTC representation, ignoring any time zone information.

Example (Converting DateTime values to UTC Dates)

import { DateTime } from "effect"

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

const utcDate = DateTime.toDateUtc(dt)
console.log(utcDate.toISOString()) // "2024-01-01T12:00:00.000Z"
converting
export const toDateUtc: (self: DateTime) => Date = Internal.toDateUtc
Referenced by 4 symbols