Why is GetDate AND GETDATE() AT TIME ZONE 'GMT Standard Time' returning the wrong time?
7
votes
2
answers
11678
views
Please see the code below:
DECLARE @UKDateTime as DateTime
SELECT @UKDateTime = GETDATE() AT TIME ZONE 'GMT Standard Time'
print @UKDateTime
PRINT GETDATE()
This returns:
Oct 4 2021 4:03PM
Oct 4 2021 4:03PM
The time in the UK is currently: 5:03pm (as confirmed by my PC clock). It appears to be returning the UTC date. What is the problem?
I have SQL Server setup as a Docker container. It is SQL Server v18.4.
Asked by w0051977
(513 rep)
Oct 4, 2021, 04:07 PM
Last activity: Mar 22, 2024, 11:18 AM
Last activity: Mar 22, 2024, 11:18 AM