C# Program 6: How to convert UTC to Alaskan 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("Alaskan Standard Time"));
Console.WriteLine("Alaskan Standard Time is: " + converted.ToLongDateString() + converted.ToShortTimeString());
Console.ReadKey();
}
}
If you have any queries or suggestions, please feel free to ask in comments section.
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("Alaskan Standard Time"));
Console.WriteLine("Alaskan Standard Time is: " + converted.ToLongDateString() + converted.ToShortTimeString());
Console.ReadKey();
}
}
If you have any queries or suggestions, please feel free to ask in comments section.
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.