Give how to get the time required time zone.

  • Thread starter Alexander Vasilevsky
  • 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
 
T

Teemu

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
 

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