Sharepoint client API invalid DateTime field
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:
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 开发者_Go百科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:
What's wrong here?
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.
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.
精彩评论