Saturday, January 24, 2015

Convert Timezone UTC to Local Time e.g TimeZoneInfo.FindSystemTimeZoneById("India Standard Time")


Convert UTC to Local TimeZone

 
public class TimeZoneConvertorHelper
    {
        private static readonly TimeZoneInfo IndiaTimeZone;

        static TimeZoneHelper()
        {
            IndiaTimeZone = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");       
        }

        public static DateTime GetCurrentMelbourneDateTime()
        {
            return TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, IndiaTimeZone);
        }
    }

No comments :