Since Java 8 you can usecall java.time.Instant.toEpochMilli().
For example the call
final long currentTimeJava8 = Instant.now().toEpochMilli(); which gives you the same results as
final long currentTimeJava1 = System.currentTimeMillis(); Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack Internal Since Java 8 you can usecall java.time.Instant.toEpochMilli().
For example the call
final long currentTimeJava8 = Instant.now().toEpochMilli(); which gives you the same results as
final long currentTimeJava1 = System.currentTimeMillis(); Since Java 8 you can use
final long currentTimeJava8 = Instant.now().toEpochMilli(); which gives you the same results as
final long currentTimeJava1 = System.currentTimeMillis(); Since Java 8 you can call java.time.Instant.toEpochMilli().
For example the call
final long currentTimeJava8 = Instant.now().toEpochMilli(); gives you the same results as
final long currentTimeJava1 = System.currentTimeMillis();