2

I am trying to display an event which is in UK timezone to the user's local timezone. Let's say if the user is in China then, javascript will extract the timezone using Intl.DateTimeFormat().resolvedOptions().timeZone and pass it on to a query to SQL Server 2016 database to get the output in local timezone. Now I need to map Intl.DateTimeFormat().resolvedOptions().timeZone to SQl Server timezone.

Where do i find the all the values returned by Intl.DateTimeFormat().resolvedOptions().timeZone ?

I have to map these values to SQL Server 2016 timezone (https://dzone.com/articles/dates-and-times-in-sql-server-at-time-zone) .

Looks like values returned are specific to browser.

kbodh
  • 31
  • 1
  • 3

1 Answers1

1

The values returned from Intl.DateTimeFormat().resolvedOptions().timeZone are IANA tz database identifiers. You can find a list of them here.

To convert to the Windows time zone identifiers that SQL Server's AT TIME ZONE function uses, you'll need to use the mappings from CLDR.

If you are writing your back-end application using .NET, then the easiest way to do this is with my TimeZoneConverter library, as described in this answer.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575