简体   繁体   中英

Exception in thread "main" java.lang.NumberFormatException: For input string: "8/3/2012"

Why I'm getting these error message.

Exception in thread "main" java.lang.NumberFormatException: For input string: "8/3/2012"
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222)
    at java.lang.Double.parseDouble(Double.java:510)
    at com.exel.raf.seeit.ExecuteImport.excelDtToString(ExecuteImport.java:713)
    at com.exel.raf.seeit.ExecuteImport.generateItemHistorySql(ExecuteImport.java:649)
    at com.exel.raf.seeit.ExecuteImport.execute(ExecuteImport.java:56)
    at com.exel.raf.seeit.ExecuteImport.main(ExecuteImport.java:38)
    Process exited with exit code 1.

If you are trying to convert String to Number. In the above case I think your String is "8/3/2012". For converting to any number, you must not have any characters other than numbers or you can have double if you want decimals.

This looks like a date, please explore the Date class and see how you can convert it to a date.

Date 8/3/2012 is not proper numeric type. Check the line of code where you are parsing it to Double.

From the java docs,

Thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format.

refer here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM