Converting Times (UTC to Local) – SharePoint

Recently came across a scenario using SharePoint 2010, Duet, and SAP. The scenario being when submitting data to SAP from SharePoint any Date/Time fields would be stored in SAP using the local time of the user whom submitted the data. However when the data is sent back to SharePoint, the Netweaver layer converts any Date/Time fields to UTC time.

After a little research found some very useful information on MSDN that handles the conversion of UTC time to local time based on the regional settings of the SPWeb.

Two useful methods included in the SPTimeZone class:

Examples of how to implement the methods are available on MSDN

SPTimeZone Class: