Convert local time zone to PST zone in C #

Say my time zone in the system right now is + 5GMT

right now on my machine 01/14/2012 05:52PM I want to convert it to PST timezone, for example

 1/14/12 4:52:50 AM PST 

and vice versa PST to GMT

+6
source share
2 answers
 TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Pacific SA Standard Time"); DateTime newDateTime = TimeZoneInfo.ConvertTime(existingDateTime, timeZoneInfo); 

You can see the full schedule of available time zones here.

Also see Convert between any two time zones.

+16
source

Below convert the code to PST.

 TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); 
-2
source

Source: https://habr.com/ru/post/905966/


All Articles