• Got a Tipila, google, windows live or facebook account ?

Use the following code to get the current time zone in the GMT + XX:XX format

zone gives the time zone

 string zone = string.Empty;
        if (TimeZoneInfo.Local.BaseUtcOffset.TotalMinutes == 0)
            zone = " GMT";
        else if (TimeZoneInfo.Local.BaseUtcOffset.TotalMinutes > 0)
            zone = " GMT + " + Math.Abs(TimeZoneInfo.Local.BaseUtcOffset.Hours).ToString() + ":" + Math.Abs(TimeZoneInfo.Local.BaseUtcOffset.Minutes).ToString();
        else if (TimeZoneInfo.Local.BaseUtcOffset.TotalMinutes < 0)
            zone = " GMT - " + Math.Abs(TimeZoneInfo.Local.BaseUtcOffset.Hours).ToString() + ":" + Math.Abs(TimeZoneInfo.Local.BaseUtcOffset.Minutes).ToString();
1
votes
Hi...!!!

Tipila is a site for programmers to save interesting things found on the web, as Tips.

No more wasting time by re-googling for things you've found but forgotten.

It's totally free...
Get started now

Login to Tipila