The String source is unknown while using the parse methode!

Posted by kawtousse on Stack Overflow See other posts from Stack Overflow or by kawtousse
Published on 2010-04-29T15:10:14Z Indexed on 2010/04/29 15:17 UTC
Read the original article Hit count: 273

Filed under:
|

Hi everyone, to parse a string to a date sql valid:

SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");            
    java.util.Date date = null;
    try {
        date =  df.parse(dateimput);
    } catch (ParseException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
    }

with dateimput is what i get from my form like that: String dateimput=request.getParameter("datepicker");
but when running see the error:

java.text.ParseException: Format.parseObject(String) failed at java.text.Format.parseObject(Unknown Source) at ServletEdition.doPost(ServletEdition.java:70)
so it mean that dateimput is not known + I note that it is correctly dislayed when:

 System.out.println("datepicker:" +dateimput);

Thanks.

© Stack Overflow or respective owner

Related posts about parsing

Related posts about java