Convert to Csharp Time - CSharp System

CSharp examples for System:DateTime Convert

Description

Convert to Csharp Time

Demo Code


using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from  w w w  .  j  a  v  a  2 s  .c  o  m

public class Main{
        public static DateTime ConverttoCsharpTime(long timeStamp)
        {
            DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
            long lTime = long.Parse(string.Format("{0}{1}", timeStamp.ToString(), "0000000"));
            TimeSpan toNow = new TimeSpan(lTime);
            return dtStart.Add(toNow);
        }
}

Related Tutorials