Skip to content

Instantly share code, notes, and snippets.

@havarnov
Created March 1, 2024 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save havarnov/cd6d2473202a43aafe2c5c10673e6f51 to your computer and use it in GitHub Desktop.
Save havarnov/cd6d2473202a43aafe2c5c10673e6f51 to your computer and use it in GitHub Desktop.
DECLARE @Timestamp AS DATETIMEOFFSET = '2024-03-03T23:05:00.000Z'
--DECLARE @TimeZone AS NVARCHAR(MAX) = 'Central Europe Standard Time';
DECLARE @TimeZone AS NVARCHAR(MAX) = 'GMT Standard Time';
SELECT DATEPART(
ISO_WEEK,
CONVERT(
DATETIMEOFFSET,
SWITCHOFFSET(
@Timestamp,
DATEPART(
TZOFFSET ,
@Timestamp AT TIME ZONE @TimeZone)),
0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment