开发者

Equivalent to Java's System.currentTimeMillis() in .NET?

Is there a .NET equivalent to Java's System.curre开发者_如何转开发ntTimeMillis()?

I want to find the number of milliseconds since 1970.


    Dim epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
    Dim millis = CLng((DateTime.UtcNow - epoch).TotalMilliseconds)


Try the following

(DateTime.Now - New DateTime(1970, 1, 1)).TotalMilliseconds


Try the following function

(DateTime.UtcNow- New DateTime(1970, 1, 1)).TotalMilliseconds

will generate the exact value as System.CurrentMillis() in Java

Thanks for the answer of JaredPar

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜