SharePoint日期结果使用CAML和JavaScript错误

问题描述 投票:0回答:1

我已经从SharePoint列表中使用CAML + JavaScript进行了搜索。在该列表中,例如,日期列的值为2020-01-01 00:00。当我运行代码时,CAML给我日期2019-12-31 23:00

有人可以帮我吗?Tks

javascript date sharepoint caml
1个回答
0
投票

正如沃克所说,SharePoint中存储的时间是UTC时区。

您可以通过这种方式将其转换为当地时间。将'UTC'附加到字符串之前,然后将其转换为javascript中的日期:

演示:new Date('5/8/2020 4:00:00 PM UTC').toLocaleString()enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.