Converting from UTC To Local Time Zone

ATTENTION: This forum is no longer active. Please navigate to our new support site at
Viewing 0 posts (of 0 total)
User - Author
Post count: 27

Hi Aron, I have this code to convert from UTC to Local Time Zone in the console application. How do you write the same code in Starfish? Will you please guide me. Thanks! using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { // DateTime timeUtc = DateTime.UtcNow; DateTime timeUtc = new DateTime(2012, 07, 24, 13, 00, 00); try { TimeZoneInfo pstZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); DateTime pstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, pstZone); Console.WriteLine("The date and time are {0} {1}.", pstTime, pstZone.IsDaylightSavingTime(pstTime) ? pstZone.DaylightName : pstZone.StandardName); } catch (TimeZoneNotFoundException) { Console.WriteLine("The registry does not define the Pacific Standard Time zone."); } catch (InvalidTimeZoneException) { Console.WriteLine("Registry data on the Pacific STandard Time zone has been corrupted."); } Console.ReadLine(); } } }

Viewing 0 posts (of 0 total)

Forum Login

Login or sign up for our forums to connect to the user community.


You must log in to post.

Not a Member? Register.