关于日期的转化--把00:00:00转化城0.00小时!

时间:2023-01-14 13:57:38
public static String getShowTime(String timeString) {
int firstIndex = timeString.indexOf(':');
int secondIndex = timeString.lastIndexOf(':');
float hour = Float.parseFloat(timeString.substring(0, firstIndex));
float min = Float.parseFloat(timeString.substring(firstIndex + 1,
secondIndex));
float totalTime = hour + (min / 60);
DecimalFormat fnum = new DecimalFormat("##0.00");
String dd = fnum.format(totalTime);
return dd;
}