If you don’t want to drag in libraries, it’s simple enough to do yourself using a Formatter, or related shortcut eg. given integer number of seconds s:
String.format("%d:%02d:%02d", s / 3600, (s % 3600) / 60, (s % 60));
More Related Contents:
- java.text.ParseException: Unparseable date: "Augu 16, 1979" [duplicate]
- JFormattedTextField : input time duration value
- Java Convert GMT/UTC to Local time doesn’t work as expected
- How to convert date in to yyyy-MM-dd Format?
- Formatting a Duration in Java 8 / jsr310
- Java: How to convert a string (HH:MM:SS) to a duration?
- return date type with format in java [duplicate]
- Is there a date format to display the day of the week in java?
- In selection sort, if we have two duplicate elements, what is the behavior of the algorithm?
- android pass ArrayList to activity
- “Expected BEGIN_OBJECT but was STRING at line 1 column 1”
- Relationship between hashCode and equals method in Java [duplicate]
- How to convert a String to a Date using SimpleDateFormat?
- What happens when you increment an integer beyond its max value?
- Execute .jar file from a Java program
- Running a java program from another java program
- SQL Server JDBC Error on Java 8: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption
- Mocking time in Java 8’s java.time API
- Add Jbutton to each row of a Jtable
- Passing parameters to a controller when loading an FXML [duplicate]
- Binary XML file line #0: Error inflating class ImageView [duplicate]
- How to deal with the URISyntaxException
- Prevent XXE Attack with JAXB
- Get original pattern String given a JDK 8 DateTimeFormatter?
- Adding char and int
- Java’s “os.name” for Windows 10?
- Java JScrollBar Design
- Google Guava “zip” two lists
- How to convert a Java String to an ASCII byte array?
- Breaking down RSA/ECB/OAEPWithSHA-256AndMGF1Padding