CSharp examples for System:DateTime Unix
Convert UNIX-Time to local DateTime
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from w w w . ja va 2 s . c om*/ public class Main{ /// <summary> /// Convert UNIX-Time to local DateTime /// </summary> /// <param name="unixTime">Number of seconds since the Unix Epoch (1st of January 1970 00:00:00 GMT)</param> /// <returns></returns> public static DateTime UnixTimeToDateTime(ulong unixTime) { DateTime result = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); return result.AddSeconds(unixTime).ToLocalTime(); } }