我的Sql服务器存在于UTC中。当我选择时,我想获取添加了+5:30
的DATE。
select cl.ChangeStatus,cl.created_at from LogTable cl join Table t on cl.Id=t.ID;
ChangeStatus created_at
----------------------------------
submitted 2019-01-10 08:03:11
sent 2019-01-10 08:06:55
sent 2019-01-10 08:08:14
sent 2019-01-10 08:09:03
complete 2019-01-10 08:09:54
ChangeStatus created_at
--------------------------------
submitted 2019-01-10 12:33:11
sent 2019-01-10 12:36:55
sent 2019-01-10 12:38:14
sent 2019-01-10 12:39:03
complete 2019-01-10 12:39:54
答案 0 :(得分:0)
以下查询应该可以解决问题:
select
cl.ChangeStatus,
Todatetimeoffset(cl.created_at, '+5:30') as created_at
from LogTable cl
join Table t on cl.Id=t.ID;