I’ve just discovered this quick Groovy-sourced solution:
import groovy.time.TimeCategory
import groovy.time.TimeDuration
Date start = new Date()
// do something here
Date stop = new Date()
TimeDuration td = TimeCategory.minus( stop, start )
println td
More Related Contents:
- How to get the day from timezone in java [duplicate]
- How to parse a date? [duplicate]
- How do you format the day of the month to say “11th”, “21st” or “23rd” (ordinal indicator)?
- How to convert java.util.Date to java.sql.Date?
- Dates with no time or timezone component in Java/MySQL
- How do I check if a date is within a certain range?
- Adding days to a date in Java [duplicate]
- Java: Check the date format of current string is according to required format or not [duplicate]
- Java, Calculate the number of days between two dates [duplicate]
- How to get the first day of the current week and month?
- How to accept Date params in a GET request to Spring MVC Controller?
- Extract time from date String
- How can I fix “unsupported class file major version 60” in IntelliJ IDEA?
- Calculating the difference between two Java date instances
- Spring Boot Jackson date and timestamp Format
- How to convert a date to milliseconds
- Comparing date strings in Java [duplicate]
- Generic support for ISO 8601 format in Java 6
- Convert between LocalDate and sql.Date [duplicate]
- Why does Java’s Date.getYear() return 111 instead of 2011?
- Parse String date in (yyyy-MM-dd) format
- Java: Get month Integer from Date
- Converting date-string to a different format
- Groovy: Create a Map with JAX-B Object’s specific attributes
- How to get Date in the same format as String [duplicate]
- Date object to Calendar [Java]
- Integration Test with Spring Boot and Spock
- calculate business days including holidays
- Parse time of format hh:mm:ss [closed]
- Java SimpleDateFormat pattern for W3C XML dates with timezone [duplicate]