Converts long value to Date given an Epoch time - CSharp System

CSharp examples for System:DateTime Convert

Description

Converts long value to Date given an Epoch time

Demo Code



public class Main{
        /// <summary>
        ///     Converts to Date given an Epoch time
        /// </summary>
        public static DateTime ToDateTime(this long epoch) => new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(epoch);
}

Related Tutorials