TimeZone problems

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top