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...Skins, Themes, ...Skins, Themes, ...CurrentDate - is what date?CurrentDate - is what date?
Previous
 
Next
New Post
4/6/2006 4:15 PM
 
I decided to take a look at this and the answer is actually quite complicated. First off, everything is tiered, starting at the server time as the lowest level. From what I can tell, the portal's time zone is assumed to be the same as the server (this is where we're having problems). This is then adjusted by the user's time zone. Here's the math...

timeZone = userTimeZone - portalTimeZone
displayTime = serverTime + timeZone

Assuming a CST server, UTC portal, and CST user at 12:00 CST...

timeZone = (-6) - (0) = -6
displayTime = (12:00) + (-6:00) = 6:00


I'm sure you see the problem. The server's time zone is not factored into the equation. Most people probably don't notice because they are only a few time zones off, if that. The people who are probably having the problem are those running portals with hosts and users across the globe. Like my example, for instance - a US-based host, England-based portal, and US users. This will end up using the user's time zone against them.

From what I can tell, the only way to fix this is to set the portal time zone to the same as the server (or vice-versa, obviously). Of course, this means your default time zone for new users will be off.

Note: This is logic based on my evaluation of what happened when I changed the three time zones. I didn't find this in code.

Michael Flanakin | Microsoft Consulting Services
www.michaelflanakin.com
 
New Post
4/7/2006 8:51 AM
 
Thanks for your analysis.  Any core team member know whether this is the case with the code?  Sorry I tried to follow it but its out of my capabilities.
Thanks
Antony
 
New Post
4/10/2006 11:55 PM
 
WEBPC wrote
Thanks for your analysis.  Any core team member know whether this is the case with the code?  Sorry I tried to follow it but its out of my capabilities.
Thanks
Antony


Bump anyone?
 
New Post
4/11/2006 9:47 AM
 
I went ahead and dug thru the code... My assumptions were correct. This logic is maintained in the DotNetNuke.Entities.Users.UserTime class (components\Users\UserTime.cs). To fix it, change the following property...

Public ReadOnly Property CurrentUserTime() As DateTime
  Get
    Dim context As HttpContext = HttpContext.Current
    Dim objSettings As PortalSettings = PortalController.GetCurrentPortalSettings()
    If Not (context.Request.IsAuthenticated) Then
      Return DateTime.UtcNow.AddMinutes(objSettings.TimeZoneOffset)
    Else
      Return
DateTime.UtcNow.AddMinutes(objSettings.TimeZoneOffset).AddMinutes(ClientToServerTimeZoneFactor)
    End If
  End Get
End Property


I believe this should fix the problem.

Michael Flanakin | Microsoft Consulting Services
www.michaelflanakin.com
 
New Post
4/11/2006 10:07 AM
 

Michael Flanakin | Microsoft Consulting Services
www.michaelflanakin.com
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...CurrentDate - is what date?CurrentDate - is what date?


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