I am facing a strange issue in converting DateTime value received from SharePoint GetListItems method.

Here is what the date string looks like - ows_DatePaid="2015-04-28T18:30:00Z".

Now the problem is I had set date to 29-April and not to 28-April which I am receiving.

I have used following method to convert received DateTime.

public static DateTime ConvertFromSharePointTimeToDateTime(this string dateTimeStringToConvert)
      string format = "yyyy-MM-ddTHH:mm:ssZ";
      histryViewModel.InsertHistory("Received DateTime:", dateTimeStringToConvert);
      var converted = DateTime.ParseExact(dateTimeStringToConvert, format, CultureInfo.InvariantCulture);
      histryViewModel.InsertHistory("Converted DateTime:", converted.ToString());
      return converted;

When I browse Site from Visual Studio on my Local Machine it displays 29-April correctly.

SharePoint Server Time Zone is Eastern US and Canada.
Website deployment server timezone is UTC.
Local Machine Time Zone is UTC +5.30 Chennai, Kolkata, Mumbai, New Delhi.

Please guide me on how do effectively display same date on my Site.

What is correct way to handle this problem? Feel free to suggest me changes, so that I can improve my method.

  • I am facing same problem.
    – Ashish
    Jun 1, 2015 at 15:41

3 Answers 3


You can use below snippet to convert it programmatically

SPRegionalSettings regionalSettings = web.RegionalSettings;
SPTimeZone timeZone = regionalSettings.TimeZone;

  • Open the site on which you want to change the regional settings.
  • On the Site Actions menu, choose Site Settings.
  • On the Site Settings page, under Site Administration, choose Regional settings.
  • On the Regional Settings page, select the settings that you want for this site, and then choose the OK button

SharePoint stores dates in UTC so when you insert a date in your local time it will be converted to UTC, when you fetch the date/time it will be returned in UTC so you have to take this in consideration. See url below how to fix this.

Microsoft SharePoint Foundation stores date and time values in Coordinated Universal Time (UTC) format, and almost all date and time values that are returned by members of the object model are in UTC format. The one exception is list column values that are obtained through the indexer for the SPListItem class, which are formatted in the local time for the site. Use the DatesInUtc property of the SPQuery class to use the indexer to return values in UTC format. To convert values from UTC format to local time, use the UTCToLocalTime method of the SPTimeZone class, which can be accessed through the RegionalSettings property for the current site, as follows: mySite.RegionalSettings.TimeZone.UtcTimeToLocalTime(date). To convert values from local time to UTC format, instead use the LocalTimeToUTC method.


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.