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
精彩评论