Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Upgrading DNN P...Upgrading DNN P...Error in Time zone convertionError in Time zone convertion
Previous
 
Next
New Post
1/13/2015 6:58 AM
 

Hi,

We are getting problem in converting Timezone to user profile's Timezone in DNN 6.2.5 DNN_Forum Module. 

'Calculate the GMT time that the post was made, all calculations will be based on this

Dim GMTTime As DateTime = Posttime.AddMinutes(InvertedTimeZone)

' Set the time and reset later if per user is enabled

displayCreatedDate = PortalTime

If HttpContext.Current.Request.IsAuthenticated Then

Dim objUser As Users.UserInfo = Users.UserController.GetCurrentUserInfo

Dim UserTimeZone As Double = objUser.Profile.TimeZone

Dim UserTime As DateTime = GMTTime.AddMinutes(UserTimeZone)

displayCreatedDate = UserTime

End If

Could you please explain how it is calculating displayCreatedDate  ?

 

 
New Post
1/13/2015 7:15 AM
 
the code tries to convert stored Posttime to user time by converting to UTC (adding invertedTimezone) first and adding user time zone offset (minutes).
There are several things to validate:
- how is posttime stored and InvertedTimeZone calculated?
- does objUser.Profile.TimeZone contain the proper value (should be offset from UTC in minutes).

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
1/13/2015 9:34 AM
 

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.

 

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Upgrading DNN P...Upgrading DNN P...Error in Time zone convertionError in Time zone convertion


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out