1
votes

I have a SharePoint list with DateTime field. I'm using the Silveright SharePoint client API to update this fields. When I save a value to the field, it is saved and displayed in SharePoint without problems.

But when I try to get the value, it is absolutely different (minus some time). What's wrong with it?

In SharePoint, the datetime is:

enter image description here

Load code:

clientContext.Load(contactItem, item => item[Constants.TipFields.Title],
    item => item[Constants.TipFields.Description],
    item => item[Constants.TipFields.UserDefinedDateTime],
    item => item.Id);`

Here I have an incorrect date:

var description = tipItem[Constants.TipFields.Description] as String;
var title = tipItem[Constants.TipFields.Title] as String;
var date = tipItem[Constants.TipFields.UserDefinedDateTime] as DateTime;

And loaded datetime is: enter image description here

What's wrong here?

2
The value you retrieve is only 2 hours earlier than the value you see displayed in SharePoint. Is it a timezone conversion? - CBono
I dont want to convert value. What i suppose to do??? - Ievgen Naida
It's irrelevant what you want to do here. If SharePoint is storing the date as a UTC value but not converting it when you retrieve, then it's your job to convert it to suit your purposes. - CBono
I dont need sharepoint to convert my date time. This field indicating when server recieved value. - Ievgen Naida

2 Answers

5
votes

Sharepoint stores all date field in UTC. That is, if you are saving a datetime field in a list, Sharepoint actually converts the time that you selected into UTC, and converts it back to whatever time zone the person is in when retrieving.

Begin by checking if there's a difference between your server timezone and your client.

0
votes

You can solve this bug (feature in sharepoint) by using simple plain text or custom field to store specific date time not in UTC format.