I am using the following answer to validate the time entered into a textbox:
Parsing user time input in Java/GWT
This returns milliseconds in Long format. So now I want to convert that to 24 hour format. So I use this suggestion:
long startTime = parseTime(textBoxStartTime.getText());
long second = (startTime / 1000) % 60;
long minute = (startTime / (1000 * 60)) % 60;
long hour = (startTime / (1000 * 60 * 60)) % 24;
String time = String.format("%02d:%02d:%02d", hour, minute, second);
Based on:
java convert milliseconds to time format
However, I get the following error when I compile:
[ERROR] Errors in 'file:/C:/Users/Glyndwr/workspace/AwardTracker_N/src/org/AwardTracker/client/HikeDetailsView.java'
[ERROR] Line 387: The method format(String, long, long, long) is undefined for the type String
I have also tried:
String startTimeString = DateTimeFormat.getFormat("HH:mm").format(startTime);
Which gives the error:
Thee method format(Date) in the type DateTimeFormat is not applicable for the arguments (long)