Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Local Time Zone to PST Time Zone in C#

Tags:

timezone

c#

Let say my time zone in system right now is +5GMT

right now on my machine 01/14/2012 05:52PM I want to convert it into PST time zone like

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

and vice versa PST to GMT

like image 975
SOF User Avatar asked Jan 14 '12 12:01

SOF User


1 Answers

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

DateTime newDateTime = TimeZoneInfo.ConvertTime(existingDateTime, timeZoneInfo);

You can see complete chart of available Time Zones here

Also take a look at Converting Between Any Two Time Zones

like image 126
Haris Hasan Avatar answered Sep 20 '22 09:09

Haris Hasan