Reputation: 515
How can I re-write the code below (that is written in C#), in java to get same result?
TimeSpan Now = DateTime.UtcNow.Subtract(new DateTime(1970,1, 1));
long TimeStamp = Convert.ToInt64(Math.Floor(Now.TotalMilliseconds));
I want to translate the C# code to java language to get the value of TimeStamp (long variable).
Upvotes: 1
Views: 1512
Reputation: 562
you can use this :
java.util.Date date= new java.util.Date();
System.out.println(new Timestamp(date.getTime()));
Upvotes: 1