R
Roshawn Dawson
Hi,
I have a datetime value that is already in GMT (UTC) time. What I would like to do is convert this
value into Pacific Standard Time, but I also need to account for daylight savings time.
Simply subtracting eight hours from the value will give me the proper time (subtracting seven hours
if daylight savings time). I tried using the TimeZone object to see if the value is in daylight
savings time like this
If TimeZone.IsDaylightSavingTime (value) = True Then
value.AddHours(-7)
Else
value.AddHours(-8)
End If
However, I always get a NullReferenceException (i.e. object reference not set to an instance of an
object) for the TimeZone object.
How do I properly use the TimeZone object? Since it is labeled as MustInherit, do I need to create
an object that inherits the TimeZone object just to use this method?
Thanks,
Roshawn
I have a datetime value that is already in GMT (UTC) time. What I would like to do is convert this
value into Pacific Standard Time, but I also need to account for daylight savings time.
Simply subtracting eight hours from the value will give me the proper time (subtracting seven hours
if daylight savings time). I tried using the TimeZone object to see if the value is in daylight
savings time like this
If TimeZone.IsDaylightSavingTime (value) = True Then
value.AddHours(-7)
Else
value.AddHours(-8)
End If
However, I always get a NullReferenceException (i.e. object reference not set to an instance of an
object) for the TimeZone object.
How do I properly use the TimeZone object? Since it is labeled as MustInherit, do I need to create
an object that inherits the TimeZone object just to use this method?
Thanks,
Roshawn