Created
March 19, 2025 08:40
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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