[Solved] How to subtract time with current time


The time difference (in milliseconds) can be obtained using:

ChronoUnit.MILLIS
   .between(Instant.parse("2018-07-26T16:00:17.163Z"), Instant.now())

Instant.now() will be the current UTC time, and your input date is UTC time, which makes the diff sensible. Regardless of the current time zone, the difference will be consistent.

You can change the time unit accordingly (such as ChronoUnit.HOURS).

0

solved How to subtract time with current time