Java Long To CSharp DateTime - CSharp System

CSharp examples for System:DateTime Calculate

Description

Java Long To CSharp DateTime

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from   w ww  . jav  a  2  s.  com

public class Main{
        static public DateTime JavaLongToCSharpLong(long javaLong)
        {
            TimeSpan ss = TimeSpan.FromMilliseconds(javaLong * 1000);
            DateTime Jan1st1970 =
                new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            DateTime ddd = Jan1st1970.Add(ss);
            DateTime final = ddd.ToUniversalTime();

            return ddd;
        }
}

Related Tutorials