Is there any way to be able to select in SQL the current date and time of the time zone assigned to the database, even if the user changes the date of the operating system?
I have tried with the following sentences but if I change the date of the S.O., it gives me that date and time and not the current one.
SELECT CONVERT (year, SYSDATETIME())
,CONVERT (date, SYSDATETIMEOFFSET())
,CONVERT (date, SYSUTCDATETIME())
,CONVERT (date, CURRENT_TIMESTAMP)
,CONVERT (date, GETDATE())
,CONVERT (date, GETUTCDATE());
SELECT TODATETIMEOFFSET (SYSDATETIMEOFFSET (), '+04: 00') 'GetCurrentOffSet + 4';
I am working with SQL server 2008 R2.