Unix Time Stamp To Date Time - CSharp System

CSharp examples for System:DateTime Timestamp

Description

Unix Time Stamp To Date Time

Demo Code


using System;/*from  ww  w.  j a  va 2  s. c o  m*/

public class Main{
        public static DateTime UnixTimeStampToDateTime(double unixTimeStamp)
        {
            // Unix timestamp is seconds past epoch
            System.DateTime dtDateTime = new DateTime(1970,1,1,0,0,0,0,System.DateTimeKind.Utc);
            dtDateTime = dtDateTime.AddSeconds( unixTimeStamp ).ToLocalTime();
            return dtDateTime;
        }
}

Related Tutorials