在项目添加/项目更新中获取不同的UTC和本地时间 [英] Getting different UTC and local times in Item Adding / Item Updating

查看:50
本文介绍了在项目添加/项目更新中获取不同的UTC和本地时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在一个网络中有两个列表,其中包含没有时间信息的日期/时间字段。当我收到ItemAdding事件并观看 日期字段时,我有以下值:

I have to two lists in one web with a date/time field without time information. When I catch the ItemAdding event and watch the date field I've got the following values:

列表1:
$
日期字段:2018-11 -05T23:00:00Z / UTC:05.11.2018 23:00:00 /当地时间:06.11.2018 00:00:00

List 1:
Date Field: 2018-11-05T23:00:00Z / UTC: 05.11.2018 23:00:00 / Local: 06.11.2018 00:00:00

清单2:

日期字段:2018-11-06T00:00:00Z / UTC:06.11.2018 00:00:00 / Local:06.11.2018 01:00:00

List 2:
Date Field: 2018-11-06T00:00:00Z / UTC: 06.11.2018 00:00:00 / Local: 06.11.2018 01:00:00

我不明白,为什么同一网站中的列表给出了不同的UTC日期/时间值。


当我在ItemUpdating事件中捕获字段时,我得到了这个值:

I do not understand, why a list in the same web gives me different UTC date/time values.
When I catch the field in the ItemUpdating event I've got this values:

列表1:

数据字段:2018-11-06T00:00:00Z / 06.11.2018 00:00:00 / 06.11.2018 01:00:00

List 1:
Data Field: 2018-11-06T00:00:00Z / 06.11.2018 00:00:00 / 06.11.2018 01:00:00

清单2:

数据字段:2018-11-06T00:00:00Z / 06.11.2018 00:00:00 / 06.11.2018 01:00:00

List 2:
Data Field: 2018-11-06T00:00:00Z / 06.11.2018 00:00:00 / 06.11.2018 01:00:00

是否有人对此有解释?

推荐答案

我发现从浏览器(客户端)发送的请求在两个列表之间有所不同。

I figured out that the requests send from the browser (client) differ between the two lists.

第一个列表通过application / json发送请求。请求正文是可读的:

The first list send the request via application/json. The request body is readable:

<Object TypeId="{03745a5a-2400-440e-92d6-dad4afee30a6}">
    <Property Name="ErrorMessage" Type="Null" />
    <Property Name="FieldName" Type="String">DateField</Property>
    <Property Name="FieldValue" Type="String">06.11.2018</Property>
    <Property Name="HasException" Type="Boolean">false</Property>
</Object>

 第二个列表通过text / html发送请求。请求正文不可读。

The second list send the request via text/html. The request body is not readable.

我的建议是,第二个列表比第一个列表"更旧",并且被CU包和SP13转换为SP16多次。是否有人建议如何在Web中将所有列表中的此行为更改为相同?

My suggestion is, that the second list is 'older' than the first one and was converted multiple times by CU packages and from SP13 to SP16. Does someone have a suggestion how I can change this behavior in a web for all lists to the same?

当我在两个列表中编辑这两个项目时,请求始终以text / html格式发送并按预期工作!

When I edit both items in the two lists the request is always send as text/html and works as expected!


这篇关于在项目添加/项目更新中获取不同的UTC和本地时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆