C# Program 4: How to convert UTC to Samoa Standard Time format

C# Program 4: How to convert UTC to Samoa Standard Time format


    class Program
    {
        static void Main(string[] args)
        {
            string sDateTime = "2019-03-03T16:30:00.0000000+00:00Z";
            DateTime src = DateTime.Parse(sDateTime).ToUniversalTime();
            Console.WriteLine("UTC Time is"+src.ToLongDateString() + src.ToShortTimeString());

            DateTime converted = TimeZoneInfo.ConvertTimeFromUtc(src, TimeZoneInfo.FindSystemTimeZoneById("Samoa Standard Time"));
            Console.WriteLine("Samoa Standard Time is" + converted.ToLongDateString() + converted.ToShortTimeString());
            Console.ReadKey();

        }
    }

Output: 
UTC Time isSunday, March 3, 20194:30 PM
Samoa Standard Time isMonday, March 4, 20196:30 AM

Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar