From Unix Time to DateTime - CSharp System

CSharp examples for System:DateTime Unix

Description

From Unix Time to DateTime

Demo Code


using System.Text;
using System.Collections.Generic;
using System;/*w  w  w. j ava  2 s.  c  o m*/

public class Main{
        public static DateTime FromUnixTime(this long unixTime)
      {
         var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
         return epoch.AddSeconds(unixTime);
      }
}

Related Tutorials