.Net Tips — Finding the time in a given TimeZone

You can find the cur­rent time in a dif­fer­ent time zone using the Time­Zone­In­fo class.

To find all the avail­able sys­tem time zones:

var timezones = TimeZoneInfo.GetSystemTimeZones();

From the returned val­ues you can see the

So, if I want to find out what the time is in Ams­ter­dam:



I can do this to get the time in HH:mm:ss for­mat:

var timeZone = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time");
string s = TimeZoneInfo.ConvertTime(DateTime.Now, timeZone).ToString("HH:mm:ss");

Liked this post? Why not support me on Patreon and help me get rid of the ads!