Give how to get the time required time zone.

  • Thread starter Thread starter Alexander Vasilevsky
  • Start date Start date
A

Alexander Vasilevsky

I need to know the time required time zone.
ie the machine can be set arbitrary time zone and need to know LA time.
2 operator of the idea - but what. Class date the first time did not help.

http://www.alvas.net - Audio tools for C# and VB.Net developers + Christmas
Gift
 
Alexander Vasilevsky said:
I need to know the time required time zone.
ie the machine can be set arbitrary time zone and need to know LA time.
2 operator of the idea - but what. Class date the first time did not help.

Here are two different solutions:

This is for .NET 3.5:

MsgBox(TimeZoneInfo.ConvertTime(Now,
TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")))

***

This is a more generic solution:

MsgBox(Now.ToUniversalTime.AddHours(-8))

***

You can replace Now with any DateTime object you like.

-Teemu
 
Back
Top