DateTime To Utc Time - CSharp System

CSharp examples for System:DateTime UTC

Description

DateTime To Utc Time

Demo Code


using System.Configuration;
using System;/*from  w w w . ja v  a 2s.  c  o  m*/

public class Main{
        public static DateTime ToUtcTime(this DateTime dt)
        {
            var tzi = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
            return TimeZoneInfo.ConvertTimeToUtc(dt, tzi);
        }
}

Related Tutorials