The below code working fine in DNN 6.0.2 to get time based on User specific timezone in my DNN_Forum Module.. .
Shared Function ConvertTimeZone(ByVal value As DateTime, ByVal objConfig As Forum.Configuration) As DateTime
Dim time2 As DateTime = value
Try
Dim currentPortalSettings As Portals.PortalSettings = Portals.PortalController.GetCurrentPortalSettings
Dim time As DateTime = value
Dim currentTimeZone As TimeZone = TimeZone.CurrentTimeZone
Dim totalMinutes As Double = currentTimeZone.GetUtcOffset(DateTime.Parse("00:00")).TotalMinutes
If currentTimeZone.IsDaylightSavingTime(time) Then
totalMinutes = (totalMinutes - currentTimeZone.GetDaylightChanges(time.Year).Delta.TotalMinutes)
End If
Dim num As Double = (0 - totalMinutes)
Dim time3 As DateTime = time.AddMinutes(num)
If HttpContext.Current.Request.IsAuthenticated Then
Dim num3 As Double = Users.UserController.GetCurrentUserInfo.Profile.TimeZone
time2 = time3.AddMinutes(num3)
End If
Catch exception1 As Exception
'ProjectData.SetProjectError(exception1)
time2 = value
'ProjectData.ClearProjectError()
End Try
Return time2
End Function
----------------------------------
After upgrade my DNN to 6.2.5 , it is failing to load the value by using "Dim num3 As Double = Users.UserController.GetCurrentUserInfo.Profile.TimeZone" . Due to this we are getting GMT time in place of time based on User specific timezone .
I hope the property of "Users.UserController.GetCurrentUserInfo.Profile.TimeZone" changed in DNN 6.2.5.