Snippets tagged “duration”
4 snippets use this tag.
- Calculate date/time difference in javaJava
To calculate the difference between two dates in Java, you can use the java.time package (part of Java 8 and later) or the java.util.Calendar class (part of the older java.util package).
- How to convert Milliseconds to "X mins, x seconds" in Java?Java
To convert milliseconds to "X mins, X seconds" in Java, you can use the TimeUnit class from the java.util.concurrent package.
- Java 8: Difference between two LocalDateTime in multiple unitsJava
To find the difference between two LocalDateTime objects in multiple units, you can use the Duration class.
- Why is subtracting these two times (in 1927) giving a strange result?Java
Without more context, it is difficult to say why subtracting two times would give a strange result. Here are a few potential explanations: