Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

I have to build an application that always displays 4 major US timezones

I have to build an application that always displays 4 major US timezones. Is there a code sample I can look at? Cannot seem to find anything that easily takes current server time, as well as current timezone, and converts it to all the rest of the timezone times.

Please help.
0
vituxa
Asked:
vituxa
1 Solution
 
käµfm³d 👽Commented:
You should be able to use the following:

DateTime now = DateTime.Now;
DateTime estTime = TimeZoneInfo.ConvertTime(now, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));
DateTime cstTime = TimeZoneInfo.ConvertTime(now, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));
DateTime mstTime = TimeZoneInfo.ConvertTime(now, TimeZoneInfo.FindSystemTimeZoneById("Mountain Standard Time"));
DateTime pstTime = TimeZoneInfo.ConvertTime(now, TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"));

Open in new window

0
 
vituxaAuthor Commented:
Thank you
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now