I took Crispy's Advice and sorted it out myself, the ConvertTimezone function in the code only adjusts the displaytime by the difference between the users selected time zone and the forums configured timezone, it does not take into account the portals time zone nor the actual servers timezone at all. and as such is completely inaffective. I replaced it with the code below, it works for me, your mileage may vary
Public Shared Function ConvertTimeZone(ByVal value As DateTime, ByVal ForumConfig As Forum.Config) As DateTime
Dim displayCreatedDate As DateTime = value
Try
'OK, Solving the post time issues in the DNN Forum.
'First we will get all the relevant times and timezones we will need
'in order to calculate everything.
Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings
'Post Time is entered into the database using getdate so if your SQL Server
'and Web server are in different time zones this might make things a little more
'difficult.
Dim Posttime As DateTime = value
'We need to know the servers timezone, we will use this information to convert
'the post time to a GMT time & date, which will make it much simpler to work with.
'we will use the current timezone ofsset function from the TimeZone Class to get the
' number of minutes the servers timezone is offset from midnight GMT
Dim tz As System.TimeZone = System.TimeZone.CurrentTimeZone
Dim LocalTimeZone As Double = tz.GetUtcOffset(DateTime.Parse("00:00")).TotalMinutes
'we also want to take into account Daylight savings time, since this will affect the
'calculation as well. we will calculate daylight savings time based on when the post was made and
'not based on what the current date and time is. i.e was the post made when daylight savings time was
'in affect or not.
If tz.IsDaylightSavingTime(Posttime) Then
LocalTimeZone -= tz.GetDaylightChanges(Posttime.Year).Delta.TotalMinutes
End If
'we need to invert the timezone, when the timezone is GMT-8 for example we need to add 8 hours
'to get GMT and if the timezone is GMT+2 for Example we need to deduct 2 hours to get GMT
Dim InvertedTimeZone As Double = 0 - LocalTimeZone
'Calculate the GMT time that the post was made, all calculations will be based on this
Dim GMTTime As DateTime = Posttime.AddMinutes(InvertedTimeZone)
'the portal time zone will be a our fallback timezone, this will allow you
'to use the portals configured timezone if all else fails
Dim PortalTimeZone As Double = _portalSettings.TimeZoneOffset
'calculate the portal time that the post was made at. this will be used as our
'fallback value
Dim PortalTime As DateTime = GMTTime.AddMinutes(PortalTimeZone)
'we need to get the forums configured timezone, if the forum is not configured to
'allow us to use the users timezone this is what we will use
Dim ForumTimeZone As Double = ForumConfig.TimeZone
'calculate the forum time that the post was made, using the forums timezone.
Dim ForumTime As DateTime = GMTTime.AddMinutes(ForumTimeZone)
'is the user logged in? if he is then we can use his timezone settings.
Dim UserLoggedIn As Boolean = HttpContext.Current.Request.IsAuthenticated
'check if the portal is configured to allow us to use the users time zone.
Dim UseUserTimeZone As Boolean = ForumConfig.EnableTimeZone
'we will set the display date to the portal timezone here just incase anything goes wrong
displayCreatedDate = PortalTime
'if the forum allows us to use the users time zone then calculate it and use it
If UseUserTimeZone = True Then
'check if the user is logegd in
If UserLoggedIn = True Then
'the user timezone will allow us to display the time and date
'in the users selected timezone, if the forum is configured
'to allow it.
Dim objUser As UserInfo = UserController.GetCurrentUserInfo
Dim UserTimeZone As Double = objUser.Profile.TimeZone
Dim UserTime As DateTime = GMTTime.AddMinutes(UserTimeZone)
displayCreatedDate = UserTime
Else
'if the user is not logged in and the forum is configured to use
'the suers time zone we will fall back to the portals time zone
displayCreatedDate = PortalTime
End If
Else
'if the forum is configured not to use the users time zone we will
'use the forums configured tiem zone
displayCreatedDate = ForumTime
End If
Return displayCreatedDate
Catch
'a function as arbitary as converting the time to display it in a users timezone should never be allowed to
'cause a fatal crash, so if any exception occurs in the conversion we will simply return the displayCreatedDate
Return displayCreatedDate
End Try
End Function