[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

Time zone time

My local machine is setin 'Eastern Standard Time' time zone. The value of serverTime DateTime variable is  assigned as "8/18/2014 4:10:30 PM". I have following code to convert 'Eastern Standard Time' to UTC time.

TimeZone ServerZone = TimeZone.CurrentTimeZone;
DateTime ServerUtcTime = ServerZone.ToUniversalTime(serverTime);

ServerUtcTime value is "8/18/2014 8:10:30 PM". My queation is that why ServerUtcTime value is not "8/18/2014 9:10:30 PM", as ''Eastern Standard Time" time Offset hours to UTC is -5, which means ''Eastern Standard Time" is 5 hours behind UTC. ServerUtcTime value should be "8/18/2014 9:10:30 PM", right? As those C# TimeZone functions already considered the summer saving time.

Or should I call some other function so that saving time will be counted in? I appreciate any help.
0
minglelinch
Asked:
minglelinch
1 Solution
 
Miguel OzSoftware EngineerCommented:
Yes , the method considers day light saving rule.
You could use DateTime.ToUniversalTime
0
 
Dave BaldwinFixer of ProblemsCommented:
I'm confused.  UTC does not have Daylight Savings Time.  Only local time zones have that.  ??
0
 
minglelinchAuthor Commented:
Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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