Converts a date or date string to a UTC Date object.

Prefer createDateForTimeZone if you have a specific time zone and can provide the date time string format (e.g. '2022-10-14').

  • Parameters

    • date: string | Date

      The date or date string to convert.

    • timeZone: string = ...

      The IANA time zone name to use for the conversion. Defaults to the system time zone.

    Returns Date

    The converted UTC Date object.