在C#中将本地时区转换为PST时区

SOF*_*ser 6 c# timezone

假设我现在在系统中的时区是+ 5GMT

现在在我的机器上01/14/2012 05:52PM我想将其转换为PST时区

1/14/12 4:52:50 AM PST
Run Code Online (Sandbox Code Playgroud)

反之亦然PST到GMT

Har*_*san 19

TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Pacific SA Standard Time");

DateTime newDateTime = TimeZoneInfo.ConvertTime(existingDateTime, timeZoneInfo);
Run Code Online (Sandbox Code Playgroud)

您可以在此处查看可用时区的完整图表

另请参阅任意两个时区之间的转换