Gets the UTC adjusted time. - CSharp System

CSharp examples for System:DateTime UTC

Description

Gets the UTC adjusted time.

Demo Code


using System;/*from  w  w  w  . j  a v  a2s  .  c  o  m*/

public class Main{
        /// <summary>
        /// Gets the UTC adjusted time.
        /// </summary>
        /// <param name="source">The date.</param>
        /// <returns></returns>
        public static DateTime GetUtcAdjustedTime(this DateTime source)
        {
            return new DateTime(source.Ticks, DateTimeKind.Utc);
        }
}

Related Tutorials