I need format java.time.Duration
like
T05:00:00 (hours:minutes:seconds).
How can I do it?
The SimpleDateFormat class is within Java's utility library and it is what most people use:
import java.text.SimpleDateFormat;
import java.util.Date;
public class Time {
public static void main(String[] args) {
//instance of the time, date
Date date = new Date();
//format it however you like.
String strDateFormat = "HH:mm:ss";
//The SimpleDateFormat class allows the actual time format
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
//use the sdf object to format
System.out.println(sdf.format(date));
}
}