@rvoh/dream
    Preparing search index...

    Class DateTime

    DateTime wraps Luxon DateTime with microsecond precision (0-999). The decimal part in ISO/SQL is 6 digits: first 3 = milliseconds, next 3 = microseconds.

    Full datetime output with toSQL() is normalized to UTC. Time-only output (toISOTime, toSQLTime) omits timezone offset by default. toISO() preserves the timezone of the DateTime instance.

    Index

    Constructors

    Properties

    _microseconds: number
    luxonDatetime: DateTime

    Accessors

    • get microsecond(): number

      Microsecond part of the DateTime (NOT microseconds since Unix epoch)

      This value will not exceed 999 because above that will carry over to the millisecond part of the DateTime

      Returns number

      The microsecond of the second (0–999)

    • get unixIntegerMicroseconds(): number

      Returns the epoch time in microseconds as an integer. Equivalent to toMicroseconds() since microseconds are always whole numbers.

      Returns number

      DateTime.fromISO('2026-02-07T09:03:44.123456Z').unixIntegerMicroseconds  // 1770455024123456
      
    • get unixIntegerMilliseconds(): number

      Returns the epoch time in milliseconds as an integer, truncating any fractional part.

      Returns number

      DateTime.fromISO('2026-02-07T09:03:44.123456Z').unixIntegerMilliseconds  // 1770455024123
      DateTime.fromISO('2026-02-07T09:03:44.123999Z').unixIntegerMilliseconds // 1770455024123 (not rounded up)
    • get unixIntegerSeconds(): number

      Returns the epoch time in seconds as an integer, truncating any fractional part.

      Returns number

      DateTime.fromISO('2026-02-07T09:03:44.123456Z').unixIntegerSeconds  // 1770455024
      DateTime.fromISO('2026-02-07T09:03:44.999999Z').unixIntegerSeconds // 1770455024 (not rounded up)
    • get weekdayName(): WeekdayName

      Returns the lowercase name of the weekday.

      Returns WeekdayName

      Weekday name: 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', or 'sunday'

      DateTime.fromISO('2026-02-09T09:00:00Z').weekdayName  // 'monday' (Feb 9, 2026 is a Monday)
      DateTime.fromISO('2026-02-07T09:00:00Z').weekdayName // 'saturday'
    • get DATETIME_FULL_WITH_SECONDS(): DateTimeFormatOptions

      DateTime.toLocaleString format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.

      Returns DateTimeFormatOptions

      DateTime.now().toLocaleString(DateTime.DATETIME_FULL_WITH_SECONDS)
      
    • get DATETIME_HUGE(): DateTimeFormatOptions

      DateTime.toLocaleString format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.

      Returns DateTimeFormatOptions

      DateTime.now().toLocaleString(DateTime.DATETIME_HUGE)
      
    • get DATETIME_HUGE_WITH_SECONDS(): DateTimeFormatOptions

      DateTime.toLocaleString format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.

      Returns DateTimeFormatOptions

      DateTime.now().toLocaleString(DateTime.DATETIME_HUGE_WITH_SECONDS)
      
    • get DATETIME_MED_WITH_SECONDS(): DateTimeFormatOptions

      DateTime.toLocaleString format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.

      Returns DateTimeFormatOptions

      DateTime.now().toLocaleString(DateTime.DATETIME_MED_WITH_SECONDS)
      
    • get DATETIME_MED_WITH_WEEKDAY(): DateTimeFormatOptions

      DateTime.toLocaleString format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.

      Returns DateTimeFormatOptions

      DateTime.now().toLocaleString(DateTime.DATETIME_MED_WITH_WEEKDAY)
      
    • get DATETIME_SHORT_WITH_SECONDS(): DateTimeFormatOptions

      DateTime.toLocaleString format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.

      Returns DateTimeFormatOptions

      DateTime.now().toLocaleString(DateTime.DATETIME_SHORT_WITH_SECONDS)
      
    • get TIME_24_WITH_LONG_OFFSET(): DateTimeFormatOptions

      DateTime.toLocaleString format like '09:30:23 Eastern Daylight Time', always 24-hour.

      Returns DateTimeFormatOptions

      DateTime.now().toLocaleString(DateTime.TIME_24_WITH_LONG_OFFSET)
      
    • get TIME_WITH_LONG_OFFSET(): DateTimeFormatOptions

      DateTime.toLocaleString format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.

      Returns DateTimeFormatOptions

      DateTime.now().toLocaleString(DateTime.TIME_WITH_LONG_OFFSET)
      
    • get TIME_WITH_SHORT_OFFSET(): DateTimeFormatOptions

      DateTime.toLocaleString format like '09:30:23 AM EDT'. Only 12-hour if the locale is.

      Returns DateTimeFormatOptions

      DateTime.now().toLocaleString(DateTime.TIME_WITH_SHORT_OFFSET)
      

    Methods

    • Returns the difference between this and another DateTime.

      Supports microsecond precision when 'microseconds' is included in the unit parameter.

      Type Parameters

      Parameters

      • other: DateTime

        DateTime to diff against

      • Optionalunit: U

        Unit or units to return (e.g., 'days', 'hours', ['days', 'hours', 'microseconds'])

      Returns DiffResult<U>

      Object with only the specified units (or all units if not specified)

      dt1.diff(dt2, 'days') // { days: 5 }
      dt1.diff(dt2, ['days', 'hours']) // { days: 5, hours: 3 }
      dt1.diff(dt2, ['milliseconds', 'microseconds']) // { milliseconds: 123, microseconds: 456 }
      dt1.diff(dt2) // { years: 0, months: 0, days: 0, hours: 0, minutes: 0, seconds: 1, milliseconds: 500, microseconds: 0 }
    • Returns the difference between this DateTime and now.

      Supports microsecond precision when 'microseconds' is included in the unit parameter.

      Type Parameters

      Parameters

      • Optionalunit: U

        Unit or units to return

      Returns DiffResult<U>

      Object with only the specified units (or all units if not specified)

      dt.diffNow('days') // { days: 5 }
      dt.diffNow(['days', 'hours', 'microseconds']) // { days: 5, hours: 3, microseconds: 123 }
    • Returns a new DateTime at the end of the given unit. Microsecond is 999 when unit is 'millisecond', else 0.

      Parameters

      • unit: DateTimeUnit

        Unit to extend to end of

      • Optionalopts: { useLocaleWeeks?: boolean }

        Optional options

      Returns DateTime

      A new DateTime

      DateTime.local(2017, 3, 12).endOf('month')   // 2017-03-31T23:59:59.999999
      DateTime.local(2017, 3, 12).endOf('day') // 2017-03-12T23:59:59.999999
    • Returns true if this and other represent the same instant and microsecond.

      Parameters

      Returns boolean

      true if equal

      dt1.equals(dt2)
      
    • Returns true if this DateTime is in the same unit as another.

      Parameters

      • other: DateTime

        DateTime to compare

      • unit: DateTimeUnit

        Unit to compare

      Returns boolean

      true if same

      dt1.hasSame(dt2, 'day')
      
    • Subtracts a duration from this DateTime. Supports microsecond via DurationLikeObject. Fractional milliseconds are converted to microseconds (e.g., 1.5 ms = 1 ms + 500 µs).

      Parameters

      • duration: number | DurationLikeObject

        Duration to subtract

      Returns DateTime

      A new DateTime

      DateTime.local(2017, 3, 12, 14).minus({ hours: 2 })
      DateTime.local(2017, 3, 12).minus({ milliseconds: 1.5 }) // subtracts 1ms + 500µs
    • Adds a duration to this DateTime. Supports microsecond via DurationLikeObject. Fractional milliseconds are converted to microseconds (e.g., 1.5 ms = 1 ms + 500 µs).

      Parameters

      • duration: number | DurationLikeObject

        Duration to add (DurationLikeObject with microsecond, or milliseconds number)

      Returns DateTime

      A new DateTime

      DateTime.local(2017, 3, 12).plus({ hours: 2 })
      DateTime.local(2017, 3, 12, 0, 0, 0, 0, 500).plus({ microseconds: 600 })
      DateTime.local(2017, 3, 12).plus({ milliseconds: 1.5 }) // adds 1ms + 500µs
    • Returns a new DateTime with the given locale/zone options. Microsecond is preserved.

      Parameters

      • properties: LocaleOptions

        Locale and/or zone options

      Returns DateTime

      A new DateTime

      DateTime.local(2017, 3, 12).reconfigure({ locale: 'fr' })
      
    • Returns a new DateTime with the given units set.

      Parameters

      • values: Partial<DateTimeObject>

        Object with units to set (year, month, day, hour, minute, second, millisecond, microsecond)

      Returns DateTime

      A new DateTime

      DateTime.local(2017, 3, 12).set({ hour: 14, microsecond: 500 })
      
    • Returns a new DateTime with the given locale. Microsecond is preserved.

      Parameters

      • locale: string

        Locale string (e.g. 'en-US', 'fr')

      Returns DateTime

      A new DateTime

      DateTime.local(2017, 3, 12).setLocale('fr')
      
    • Returns a new DateTime in the given zone. Microsecond is preserved.

      Parameters

      • Optionalzone: string | Zone

        Zone name or Zone instance

      • Optionalopts: { keepLocalTime?: boolean }

        Optional zone options (keepLocalTime, etc.)

      Returns DateTime

      A new DateTime

      DateTime.local(2017, 3, 12).setZone('utc')
      
    • Returns a new DateTime at the start of the given unit. Microsecond is 0 except when unit is 'millisecond' (then preserved).

      Parameters

      • unit: DateTimeUnit

        Unit to truncate to (year, month, day, hour, minute, second, millisecond)

      • Optionalopts: { useLocaleWeeks?: boolean }

        Optional options

      Returns DateTime

      A new DateTime

      DateTime.local(2017, 3, 12, 14, 30).startOf('day')   // 2017-03-12T00:00:00
      DateTime.local(2017, 3, 12, 14, 30).startOf('hour') // 2017-03-12T14:00:00
    • Returns a string representation using a format string. Supports all Luxon format tokens. Fractional second tokens (S, SSS, SSSSSS) are enhanced to include microseconds beyond Luxon's millisecond precision.

      Parameters

      • fmt: string

        Format string (e.g., 'yyyy-MM-dd HH:mm:ss', 'yyyy-MM-dd HH:mm:ss.SSSSSS')

      • Optionalopts: LocaleOptions

        Optional locale options

      Returns string

      Formatted string

      DateTime.local(2017, 3, 12).toFormat('yyyy-MM-dd')  // '2017-03-12'
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456).toFormat('yyyy-MM-dd HH:mm:ss.SSSSSS') // '2017-03-12 10:30:45.123456'
    • Returns an ISO 8601 string with 6 fractional second digits (milliseconds + microseconds).

      Preserves the timezone of the DateTime instance.

      Parameters

      • Optionalopts: ToISOTimeOptions

        Optional format options

        • suppressMilliseconds

          If true, omits fractional seconds when they are zero

        • suppressSeconds

          If true, omits seconds when they are zero

        • includeOffset

          If true, includes timezone offset

        • format

          Format variant: 'basic' (compact) or 'extended' (default, with separators)

      Returns string

      ISO string (e.g. "2024-03-15T10:30:45.123456-05:00" or "2024-03-15T10:30:45.123456Z")

      DateTime.fromISO('2024-03-15T10:30:45.123456-05:00').toISO() // '2024-03-15T10:30:45.123456-05:00'
      
    • Returns an ISO date string (date only, no time).

      Returns string

      ISO date string (e.g. "2024-03-15")

      DateTime.local(2017, 3, 12).toISODate()
      
    • Returns the time portion in ISO format with 6 fractional second digits.

      Omits timezone offset by default (e.g., '10:30:45.123456').

      Parameters

      • Optionalopts: ToISOTimeOptions

        Optional format options

        • suppressMilliseconds

          If true, omits fractional seconds when they are zero

        • suppressSeconds

          If true, omits seconds when they are zero

        • includeOffset

          If true, includes timezone offset

        • format

          Format variant: 'basic' (compact) or 'extended' (default, with colons)

      Returns string

      Time string (e.g. "10:30:45.123456" or "10:30:45.123456-05:00")

      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456).toISOTime() // '10:30:45.123456'
      
    • Returns a JavaScript Date object.

      Returns Date

      JavaScript Date

      DateTime.local(2017, 3, 12).toJSDate()
      
    • Returns an ISO 8601 formatted string for JSON serialization. This ensures DateTime objects are properly serialized to ISO format.

      Preserves the timezone of the DateTime instance.

      Returns string

      ISO datetime string with microsecond precision

      DateTime.fromISO('2026-02-07T09:03:44.123456Z').toJSON()  // '2026-02-07T09:03:44.123456Z'
      JSON.stringify({ time: DateTime.now() }) // Uses toJSON() automatically
    • Returns a localized string representation.

      Parameters

      • OptionalformatOpts: DateTimeFormatOptions

        Intl.DateTimeFormat options for formatting

      • Optionalopts: LocaleOptions

        Optional locale configuration

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns string

      Localized string

      DateTime.local(2017, 3, 12).toLocaleString()
      DateTime.local(2017, 3, 12).toLocaleString(DateTime.DATE_FULL)
      DateTime.local(2017, 3, 12).toLocaleString({ weekday: 'long' }, { locale: 'fr-FR' })
    • Returns the underlying Luxon DateTime instance. Since Luxon is immutable, it is safe to return the actual object.

      Returns DateTime

      The Luxon DateTime instance

      const dt = DateTime.now()
      const luxon = dt.toLuxon()
    • Returns the epoch time in microseconds (toMillis * 1000 + microsecond).

      Returns number

      Unix timestamp in microseconds

      DateTime.fromMicroseconds(1707234567890123).toMicroseconds()  // 1707234567890123
      
    • Returns the epoch time in milliseconds (toMillis * 1000 + millisecond).

      Returns number

      Unix timestamp in milliseconds

      DateTime.fromMicroseconds(1770455024077750).toMillis()  // 1770455024077.75
      
    • Returns an object with date/time components including microsecond.

      Returns DateTimeObject

      Object with year, month, day, hour, minute, second, millisecond, microsecond

      DateTime.local(2017, 3, 12, 5, 45, 10, 123, 456).toObject()
      
    • Returns the epoch time in seconds, including fractional milliseconds. Includes microsecond precision in the fractional part.

      Returns number

      Unix timestamp in seconds (with fractional milliseconds)

      DateTime.fromSeconds(1707234567).toSeconds()  // 1707234567
      DateTime.fromISO('2026-02-07T09:03:44.123456Z').toSeconds() // includes .123456 in fractional part
    • Returns an SQL date string (date only, no time).

      Returns string

      SQL date string (e.g. "2024-03-15")

      DateTime.local(2017, 3, 12).toSQLDate()
      
    • Returns an SQL time string with 6 fractional second digits.

      Omits timezone offset by default.

      Parameters

      • opts: { includeOffset?: boolean } = {}

        Optional SQL time format options

        • OptionalincludeOffset?: boolean

          If true, includes timezone offset

      Returns string

      SQL time string (e.g. "10:30:45.123456")

      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456).toSQLTime() // '10:30:45.123456'
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456).toSQLTime({ includeOffset: true }) // '10:30:45.123456 -04:00'
    • Returns an ISO 8601 formatted string representation. Alias for toISO().

      Preserves the timezone of the DateTime instance.

      Returns string

      ISO datetime string with microsecond precision

      DateTime.fromISO('2026-02-07T09:03:44.123456Z').toString()  // '2026-02-07T09:03:44.123456Z'
      const dt = DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456)
      `The time is ${dt}` // Uses toString() implicitly
    • Returns a new DateTime in UTC. Microsecond is preserved.

      Parameters

      • Optionaloffset: number

        Optional offset in minutes

      • Optionalopts: { keepLocalTime?: boolean }

        Optional zone options

      Returns DateTime

      A new DateTime in UTC

      DateTime.local(2017, 3, 12).toUTC()
      
    • Create a DateTime from a custom format string. Supports standard Luxon format tokens plus 'u' or 'SSSSSS' for microseconds (6 decimal places).

      Parameters

      • text: string

        The string to parse

      • format: string

        Format string using Luxon tokens (e.g., 'MM/dd/yyyy HH:mm:ss.u')

      • Optionalopts: DateTimeOptions

        Optional parsing options (zone, locale, etc.)

      Returns DateTime

      A DateTime for the parsed instant

      When the string doesn't match the format or is invalid

      DateTime.fromFormat('12/15/2017', 'MM/dd/yyyy')
      DateTime.fromFormat('12/15/2017 10:30:45', 'MM/dd/yyyy HH:mm:ss')
      DateTime.fromFormat('12/15/2017 10:30:45.123456', 'MM/dd/yyyy HH:mm:ss.u')
      DateTime.fromFormat('12/15/2017 10:30:45.123456', 'MM/dd/yyyy HH:mm:ss.SSSSSS')
      DateTime.fromFormat('mai 25, 1982', 'MMMM dd, yyyy', { locale: 'fr' })
    • Create a DateTime from an ISO 8601 string.

      Parameters

      • text: string

        ISO string (e.g. "2024-03-15T10:30:45.123456-05:00"); parses up to 6 fractional second digits

      • Optionalopts: DateTimeOptions

        Optional configuration

        • zone

          Timezone to interpret/convert the datetime in (defaults to UTC)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime for the parsed instant

      DateTime.fromISO('2024-03-15T10:30:45.123456-05:00')
      DateTime.fromISO('2024-03-15T10:30:45Z', { zone: 'America/New_York' })
    • Create a DateTime from a JavaScript Date.

      Parameters

      • date: Date

        A JavaScript Date instance

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone for the result (IANA timezone name or Zone object)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime representing the same instant

      DateTime.fromJSDate(new Date())
      DateTime.fromJSDate(new Date(), { zone: 'America/New_York' })
    • Create a DateTime from epoch microseconds.

      Parameters

      • microsecondsInput: number
      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone for the result (IANA timezone name or Zone object)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime for the given instant

      DateTime.fromMicroseconds(1707234567890123)
      DateTime.fromMicroseconds(1707234567890123, { zone: 'America/New_York' })
    • Create a DateTime from epoch milliseconds.

      Parameters

      • millisecondInput: number

        Unix timestamp in milliseconds (fractional part becomes microseconds)

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone for the result (IANA timezone name or Zone object)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime for the given instant

      DateTime.fromMillis(1707234567890)
      DateTime.fromMillis(1707234567890.123) // .123 ms = 123 microseconds
      DateTime.fromMillis(1707234567890, { zone: 'America/New_York' })
    • Create a DateTime from an object with date/time units. Fractional milliseconds are converted to microseconds (e.g., 1.5 ms = 1 ms + 500 µs).

      Parameters

      • obj: Partial<DateTimeObject>

        Object with year, month, day, hour, minute, second, millisecond, microsecond

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone for the datetime (IANA timezone name or Zone object)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime for the given components

      DateTime.fromObject({ year: 2017, month: 3, day: 12, hour: 5, minute: 45, microsecond: 123 })
      DateTime.fromObject({ year: 2017, month: 3, day: 12, millisecond: 1.5 }) // 1ms + 500µs
      DateTime.fromObject({ year: 2017, month: 3, day: 12 }, { zone: 'America/New_York' })
    • Create a DateTime from epoch seconds. Fractional seconds are converted to milliseconds and microseconds.

      Parameters

      • seconds: number

        Unix timestamp in seconds (fractional part becomes ms + µs)

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone for the result (IANA timezone name or Zone object)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime for the given instant

      DateTime.fromSeconds(1707234567)
      DateTime.fromSeconds(1707234567.123456) // .123456 seconds = 123ms + 456µs
      DateTime.fromSeconds(1707234567, { zone: 'America/New_York' })
    • Create a DateTime from an SQL datetime string.

      Parameters

      • text: string

        SQL string (e.g. "2024-03-15 10:30:45.123456"); parses up to 6 fractional second digits

      • Optionalopts: DateTimeOptions

        Optional configuration

        • zone

          Timezone to interpret the datetime in (overrides timezone in string)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime for the parsed instant

      DateTime.fromSQL('2024-03-15 10:30:45.123456')
      DateTime.fromSQL('2024-03-15 10:30:45', { zone: 'America/New_York' })
    • Create a local DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • hour: number

        Hour (0–23)

      • minute: number

        Minute (0–59)

      • second: number

        Second (0–59)

      • millisecond: number

        Millisecond (0–999)

      • microsecond: number
      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone (IANA timezone name or Zone object, defaults to local)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime in the local zone

      DateTime.local()                                    // now
      DateTime.local(2017, 3, 12) // 2017-03-12T00:00:00
      DateTime.local(2017, 3, 12, 10, 30, 45) // 2017-03-12T10:30:45
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456) // with millisecond 123 and microsecond 456
      DateTime.local(2017, 3, 12, { zone: 'America/New_York' }) // with zone option
    • Create a local DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • hour: number

        Hour (0–23)

      • minute: number

        Minute (0–59)

      • second: number

        Second (0–59)

      • millisecond: number

        Millisecond (0–999)

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone (IANA timezone name or Zone object, defaults to local)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime in the local zone

      DateTime.local()                                    // now
      DateTime.local(2017, 3, 12) // 2017-03-12T00:00:00
      DateTime.local(2017, 3, 12, 10, 30, 45) // 2017-03-12T10:30:45
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456) // with millisecond 123 and microsecond 456
      DateTime.local(2017, 3, 12, { zone: 'America/New_York' }) // with zone option
    • Create a local DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • hour: number

        Hour (0–23)

      • minute: number

        Minute (0–59)

      • second: number

        Second (0–59)

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone (IANA timezone name or Zone object, defaults to local)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime in the local zone

      DateTime.local()                                    // now
      DateTime.local(2017, 3, 12) // 2017-03-12T00:00:00
      DateTime.local(2017, 3, 12, 10, 30, 45) // 2017-03-12T10:30:45
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456) // with millisecond 123 and microsecond 456
      DateTime.local(2017, 3, 12, { zone: 'America/New_York' }) // with zone option
    • Create a local DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • hour: number

        Hour (0–23)

      • minute: number

        Minute (0–59)

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone (IANA timezone name or Zone object, defaults to local)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime in the local zone

      DateTime.local()                                    // now
      DateTime.local(2017, 3, 12) // 2017-03-12T00:00:00
      DateTime.local(2017, 3, 12, 10, 30, 45) // 2017-03-12T10:30:45
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456) // with millisecond 123 and microsecond 456
      DateTime.local(2017, 3, 12, { zone: 'America/New_York' }) // with zone option
    • Create a local DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • hour: number

        Hour (0–23)

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone (IANA timezone name or Zone object, defaults to local)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime in the local zone

      DateTime.local()                                    // now
      DateTime.local(2017, 3, 12) // 2017-03-12T00:00:00
      DateTime.local(2017, 3, 12, 10, 30, 45) // 2017-03-12T10:30:45
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456) // with millisecond 123 and microsecond 456
      DateTime.local(2017, 3, 12, { zone: 'America/New_York' }) // with zone option
    • Create a local DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone (IANA timezone name or Zone object, defaults to local)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime in the local zone

      DateTime.local()                                    // now
      DateTime.local(2017, 3, 12) // 2017-03-12T00:00:00
      DateTime.local(2017, 3, 12, 10, 30, 45) // 2017-03-12T10:30:45
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456) // with millisecond 123 and microsecond 456
      DateTime.local(2017, 3, 12, { zone: 'America/New_York' }) // with zone option
    • Create a local DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone (IANA timezone name or Zone object, defaults to local)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime in the local zone

      DateTime.local()                                    // now
      DateTime.local(2017, 3, 12) // 2017-03-12T00:00:00
      DateTime.local(2017, 3, 12, 10, 30, 45) // 2017-03-12T10:30:45
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456) // with millisecond 123 and microsecond 456
      DateTime.local(2017, 3, 12, { zone: 'America/New_York' }) // with zone option
    • Create a local DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone (IANA timezone name or Zone object, defaults to local)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime in the local zone

      DateTime.local()                                    // now
      DateTime.local(2017, 3, 12) // 2017-03-12T00:00:00
      DateTime.local(2017, 3, 12, 10, 30, 45) // 2017-03-12T10:30:45
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456) // with millisecond 123 and microsecond 456
      DateTime.local(2017, 3, 12, { zone: 'America/New_York' }) // with zone option
    • Create a local DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • Optionalopts: DateTimeJSOptions

        Optional configuration

        • zone

          Timezone (IANA timezone name or Zone object, defaults to local)

        • locale

          Locale string (e.g., 'en-US', 'fr-FR')

        • numberingSystem

          Numbering system (e.g., 'arab', 'beng')

        • outputCalendar

          Calendar system (e.g., 'islamic', 'hebrew')

      Returns DateTime

      A DateTime in the local zone

      DateTime.local()                                    // now
      DateTime.local(2017, 3, 12) // 2017-03-12T00:00:00
      DateTime.local(2017, 3, 12, 10, 30, 45) // 2017-03-12T10:30:45
      DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456) // with millisecond 123 and microsecond 456
      DateTime.local(2017, 3, 12, { zone: 'America/New_York' }) // with zone option
    • Returns the current time in the system's local zone.

      Parameters

      • __namedParameters: { zone?: string | Zone } = {}

      Returns DateTime

      A DateTime for the current instant

      const now = DateTime.now()
      
    • Create a UTC DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • hour: number

        Hour (0–23)

      • minute: number

        Minute (0–59)

      • second: number

        Second (0–59)

      • millisecond: number

        Millisecond (0–999)

      • microsecond: number
      • Optionalopts: LocaleOptions

        Options (locale, etc.)

      Returns DateTime

      A DateTime in UTC

      DateTime.utc()                                      // now in UTC
      DateTime.utc(2017, 3, 12, 5, 45, 10, 765, 123) // with microsecond
      DateTime.utc(2017, 3, 12, { locale: 'fr' }) // with options
    • Create a UTC DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • hour: number

        Hour (0–23)

      • minute: number

        Minute (0–59)

      • second: number

        Second (0–59)

      • Optionalopts: LocaleOptions

        Options (locale, etc.)

      Returns DateTime

      A DateTime in UTC

      DateTime.utc()                                      // now in UTC
      DateTime.utc(2017, 3, 12, 5, 45, 10, 765, 123) // with microsecond
      DateTime.utc(2017, 3, 12, { locale: 'fr' }) // with options
    • Create a UTC DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • hour: number

        Hour (0–23)

      • minute: number

        Minute (0–59)

      • Optionalopts: LocaleOptions

        Options (locale, etc.)

      Returns DateTime

      A DateTime in UTC

      DateTime.utc()                                      // now in UTC
      DateTime.utc(2017, 3, 12, 5, 45, 10, 765, 123) // with microsecond
      DateTime.utc(2017, 3, 12, { locale: 'fr' }) // with options
    • Create a UTC DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • hour: number

        Hour (0–23)

      • Optionalopts: LocaleOptions

        Options (locale, etc.)

      Returns DateTime

      A DateTime in UTC

      DateTime.utc()                                      // now in UTC
      DateTime.utc(2017, 3, 12, 5, 45, 10, 765, 123) // with microsecond
      DateTime.utc(2017, 3, 12, { locale: 'fr' }) // with options
    • Create a UTC DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • day: number

        Day of month

      • Optionalopts: LocaleOptions

        Options (locale, etc.)

      Returns DateTime

      A DateTime in UTC

      DateTime.utc()                                      // now in UTC
      DateTime.utc(2017, 3, 12, 5, 45, 10, 765, 123) // with microsecond
      DateTime.utc(2017, 3, 12, { locale: 'fr' }) // with options
    • Create a UTC DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • month: number

        Month (1–12)

      • Optionalopts: LocaleOptions

        Options (locale, etc.)

      Returns DateTime

      A DateTime in UTC

      DateTime.utc()                                      // now in UTC
      DateTime.utc(2017, 3, 12, 5, 45, 10, 765, 123) // with microsecond
      DateTime.utc(2017, 3, 12, { locale: 'fr' }) // with options
    • Create a UTC DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • year: number
      • Optionalopts: LocaleOptions

        Options (locale, etc.)

      Returns DateTime

      A DateTime in UTC

      DateTime.utc()                                      // now in UTC
      DateTime.utc(2017, 3, 12, 5, 45, 10, 765, 123) // with microsecond
      DateTime.utc(2017, 3, 12, { locale: 'fr' }) // with options
    • Create a UTC DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg). The last argument may be an options object instead of a time component.

      Parameters

      • Optionalopts: LocaleOptions

        Options (locale, etc.)

      Returns DateTime

      A DateTime in UTC

      DateTime.utc()                                      // now in UTC
      DateTime.utc(2017, 3, 12, 5, 45, 10, 765, 123) // with microsecond
      DateTime.utc(2017, 3, 12, { locale: 'fr' }) // with options