Use a custom format for Date value
import java.text.MessageFormat;
import java.util.Date;
public class Main {
public static void main(String[] argv) throws Exception {
Object[] params = new Object[] { new Date(), new Date(0) };
String msg = MessageFormat
.format("{0,time,HH-mm-ss} and UTC of 0 is {1,time,HH-mm-ss}", params);
System.out.println(msg);
}
}
// 08-32-33 and UTC of 0 is 16-00-00
Related examples in the same category