sql | SQL Server‎ > ‎sqlsrv | T-SQL‎ > ‎

tsql | UTC datetime

declare @dto datetimeoffset(7)
set @dto = GETUTCDATE() --SYSDATETIME() --GETDATE()
select @dto

SELECT SWITCHOFFSET (@dto, '+08:00')

http://www.sqlservercurry.com/2009/03/utc-or-gmt-time-in-sql-server-20052008.html

SELECT GETDATE() - 2009-03-28 13:08:37.553

SELECT SYSDATETIME() - 2009-03-28 13:08:37.5570000

SELECT GETUTCDATE() - 2009-03-28 07:38:37.557

SELECT SYSUTCDATETIME() - 2009-03-28 07:38:37.5570000

SELECT SYSDATETIMEOFFSET() - 2009-03-28 13:08:37.5570000 +05:30
Comments