3

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?

1 Answer 1

4

Answer is:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.