In SharePoint you might have to deal with TimeZone. Your Web Front End Server might be configured to different Time Zone. Your UserProfile Property is a different time zone

So, To Adjust the Offsets, We need to find the TimeZone of the Web and Convert that UTC. From The UTC date can then convert be back to User's TimeZone preferences stored in the UserProfile with TimeZone property.

Here the screen shots will show you where these setting are there in UI. For web this setting will be under SiteAction>SiteAdmininstration>Regional Settings

SPtimezone serverzone= SPContext.Current.Web.RegionalSettings.TimeZone;

//This Date is stored is SharePoint Store such as list Created or Modified

DateTime utcDate = serverZone.LocalTimeToUTC(date);

LocalTime="userZone.UTCToLocalTime(utcDate);

 

To get the user's time zone from the UserProfile Store.

SPServiceContext serverContext = SPServiceContext.GetContext(SPContext.Current.Web.Site);

UserProfileManager profileManager = new UserProfileManager(serverContext);

userZone = (SPTimeZone)profile[PropertyConstants.TimeZone].Value;

 

Hopefully the approach and information discussed here will be useful. Thanks for reading.

~Bye for now~