Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Answer is:

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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