Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MarkPryceMaherMSFT/30ef052159876d798dec4b9d7b941fb0 to your computer and use it in GitHub Desktop.
Save MarkPryceMaherMSFT/30ef052159876d798dec4b9d7b941fb0 to your computer and use it in GitHub Desktop.
Some code to show how to add a timezone to the datetime2 in Fabric
-- Create test table
create table datetest (d varchar(50), dt DATETIME2(6));
insert into datetest SELECT 'Central European Standard Time', CONVERT(DATETIME2(6), '2022-03-27T01:01:00', 126)
AT TIME ZONE 'Central European Standard Time';
insert into datetest SELECT 'Pacific Standard Time' , CONVERT(DATETIME2(6), '2022-03-27T01:01:00', 126)
AT TIME ZONE 'Pacific Standard Time';
select d as TimeZone, dt as DateTime_without_TimeZone,
CONVERT(DATETIME2(6), dt , 126) AT TIME ZONE d as Datetime_with_TimeZone from datetest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment