How to convert telegraph API core date: int type to Java date?

See English answers > converting long to date in Java returns 1970 11

There is date: int, a ten digit integer with a value of, for example, 1468782578 for today (Sunday, July 17, 2016). How to convert the telegraph API core date: int type to Java date? thank you.

Solution

I'm looking for a c# converter. I found Java below

public static DateTime JavaTimeStampToDateTime(double javaTimeStamp)
{
    // Java timestamp is millisecods past epoch
    System.DateTime dtDateTime = new DateTime(1970,1,System.DateTimeKind.Utc);
    dtDateTime = dtDateTime.AddSeconds(Math.Round(javaTimeStamp / 1000)).ToLocalTime();
    return dtDateTime;
}

reference resources: https://stackoverflow.com/a/250400/1032109

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>