简体   繁体   English

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

[英]SharePoint date result wrong using CAML and JavaScript

I have made a search using CAML + JavaScript from a SharePoint list.我使用 CAML + JavaScript 从 SharePoint 列表中进行了搜索。 In that list, there is date column with value is 2020-01-01 00:00 , for example.例如,在该列表中,有一个值为2020-01-01 00:00的日期列。 When I run the code, the CAML give me the date 2019-12-31 23:00 .当我运行代码时,CAML 给我日期2019-12-31 23:00

Can someone help me?有人能帮我吗? Tks Tks

As Walker said,the time stored in SharePoint is in UTC time zone.正如沃克所说,存储在 SharePoint 中的时间是 UTC 时区。

You could convert it to local time this way.您可以通过这种方式将其转换为当地时间。 Append 'UTC' to the string before converting it to a date in javascript: Append 'UTC' 转换为字符串,然后将其转换为 javascript 中的日期:

Demo: new Date('5/8/2020 4:00:00 PM UTC').toLocaleString()演示: new Date('5/8/2020 4:00:00 PM UTC').toLocaleString() 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在CAML查询中插入WHERE子句-使用SharePoint,SPServices,JavaScript和jQuery - Insert a WHERE clause in a CAML query - using SharePoint, SPServices, JavaScript, and jQuery 使用Sharepoint Designer在Sharepoint列表视图页面上的caml查询中使用JavaScript变量或函数 - Using javascript variable or function inside caml query on sharepoint list view page with sharepoint designer SharePoint列表未考虑RowLimit CAML标记-JavaScript - SharePoint List not considering RowLimit CAML Tag - JavaScript 使用Caml调用共享点列表中的第一行 - Calling the first row in sharepoint list using Caml 使用JavaScript Caml查询在两个日期之间从SharePoint列表检索数据时出错 - Error retrieving data from SharePoint list between two dates using javascript caml query 从变量或其他方法生成超链接(将JavaScript,jQuery和CAML用于SharePoint列表) - Generating a hyperlink from variables or other method (using JavaScript, jQuery, and CAML for a SharePoint List) javascript caml查询返回所有日期值 - javascript caml query returning all date values 通过JavaScript进行CAML,以从SharePoint留言板检索所有项目 - CAML from JavaScript to retrieve all items from a SharePoint Message Board JavaScript比较日期给我错误的结果 - Javascript compare date give me wrong result 使用OOP JavaScript的错误查询结果 - wrong query result using OOP JavaScript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM