(self: DateTime): numberGets the milliseconds since the Unix epoch of a DateTime.
Details
This returns the UTC timestamp regardless of any time zone information.
Example (Reading epoch milliseconds)
import { DateTime } from "effect"
const dt = DateTime.makeUnsafe("2024-01-01T00:00:00Z")
const epochMillis = DateTime.toEpochMillis(dt)
console.log(epochMillis) // 1704067200000converting
Source effect/DateTime.ts:16561 lines
export const const toEpochMillis: (
self: DateTime
) => number
Gets the milliseconds since the Unix epoch of a DateTime.
Details
This returns the UTC timestamp regardless of any time zone information.
Example (Reading epoch milliseconds)
import { DateTime } from "effect"
const dt = DateTime.makeUnsafe("2024-01-01T00:00:00Z")
const epochMillis = DateTime.toEpochMillis(dt)
console.log(epochMillis) // 1704067200000
toEpochMillis: (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) => number = import InternalInternal.const toEpochMillis: (
self: DateTime.DateTime
) => number
toEpochMillisReferenced by 1 symbols