Convert Local Time Zone to PST Time Zone in C#

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


Inspired by @HarisHasan's answer above, the following method will produce PST no matter where your code is running:

    public static DateTime GetPacificStandardTime()
    {
        var utc = DateTime.UtcNow;
        TimeZoneInfo pacificZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
        var pacificTime = TimeZoneInfo.ConvertTimeFromUtc(utc, pacificZone);
        return pacificTime;
    }

Tags:

C#

Timezone