Users Online

· Guests Online: 104

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

C# Program to Get the Universal Time

C# Program to Get the Universal Time

 

 

 

This is a C# Program to get the universal time.

Problem Description

This C# Program gets the Universal Time.

Problem Solution

Here the universal time is calculated using the timezone function.

Program/Source Code

Here is source code of the C# Program to get the Universal Time. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.

/*
 * C# Program to get the Universal Time
 */
using System;
class Program
{
    static void Main()
    {
        TimeZone zone = TimeZone.CurrentTimeZone;
        DateTime univ = zone.ToUniversalTime(DateTime.Now);
        Console.WriteLine("Universal Time is {0}",univ);
        Console.Read();
    }
}
Program Explanation

This C# program is used to get the universal time. Here the universal time is calculated using the timezone function. The ToUniversalTime() method recognizes only the current adjustment rule when converting from local time to UTC. As a result, conversions for periods before the current adjustment rule came into effect may not accurately reflect the difference between local time and UTC.

 
Runtime Test Cases
 
Universal Time is 10/22/2013 5:23:25 PM

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 1.01 seconds
10,851,898 unique visits