RangePoint RangePoint = new RangePoint();
Date nowDate = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
String now = dateFormat.format(nowDate);
if (!now.equals("")) {
System.out.println(now);
int nowTime = Integer.parseInt(now.trim());//转换出错NumberFormatException
RangePoint.getRangeToLimitSpeed(nowTime);
}
now 有值,不为null 或“”;
13:03:50
Exception in thread "main" java.lang.NumberFormatException: For input string: "13:03:50"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at com.test.cn.Deo.main(Deo.java:16)
各位大虾指点下,为什么转换会出错???
|