Question

In native SP list I have item with datetime field which shows 24.1.2010. 00:00:00. When I try get it with ClientContext, I got that item field with the time 23.1.2010. 23:00:00.

I understand that this is its internal time(on which he add +1 for my "time" (Croatia), but I can't find the good function/way to cast this field in the way that it shows me "24.1.2010. 00:00:00"

Sorry if question is stupid, but it piss me of because classic datetime casting/parsing won't do the job.

Suggestion?

Was it helpful?

Solution

Answer is:

DateTime startDate = (DateTime.SpecifyKind(DateTime.Parse(item["this should be date field in SP list"].ToString()), DateTimeKind.Utc)).ToLocalTime();

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top