復(fù)制代碼 代碼如下:
DECLARE @LocalDate DATETIME,
@UTCDate DATETIME,
@LocalDate2 DATETIME
SET @LocalDate = GETDATE()
SET @UTCDate = DATEADD(hour, DATEDIFF(hour,GETDATE(),GETUTCDATE()), @LocalDate)
SET @LocalDate2 = DATEADD(hour, DATEDIFF(hour,GETUTCDATE(),GETDATE()), @UTCDate)
SELECT '1. Now' [Now], @LocalDate [DateTime]
UNION
SELECT '2. UTC', @UTCDate
UNION
SELECT '3. Now again', @LocalDate2
您可能感興趣的文章:- PHP跨時(shí)區(qū)(UTC時(shí)間)應(yīng)用解決方案
- C++中獲取UTC時(shí)間精確到微秒的實(shí)現(xiàn)代碼
- JS如何將UTC格式時(shí)間轉(zhuǎn)本地格式
- C/C++判斷傳入的UTC時(shí)間是否當(dāng)天的實(shí)現(xiàn)方法
- JavaScript將當(dāng)前時(shí)間轉(zhuǎn)換成UTC標(biāo)準(zhǔn)時(shí)間的方法
- Python中實(shí)現(xiàn)對(duì)Timestamp和Datetime及UTC時(shí)間之間的轉(zhuǎn)換
- VBS實(shí)現(xiàn)將當(dāng)前時(shí)間轉(zhuǎn)換成UTC時(shí)間