Results 1 to 2 of 2

Thread: ParseException

  1. #1
    Preethi is offline Member
    Join Date
    Jan 2008
    Posts
    83
    Rep Power
    0

    Default ParseException

    Hi,
    I tried to convert string into date its throwing ParseException:

    java.text.ParseException: Unparseable date: "2007-11-01"
    at java.text.DateFormat.parse(DateFormat.java:335)
    at saxExamples.DataReader.list(DataReader.java:102)
    at saxExamples.DataReader.main(DataReader.java:144)
    My code is:
    Java Code:
     for(int wrk_len= 0;wrk_len<wrk.size();wrk_len++)
                       {
                            String str = list.get(wrk_len).toString();
                            SimpleDateFormat df = new SimpleDateFormat("yy/MM/dd");
                            Date date = df.parse(str);
                            ArrayList<Date> l = new ArrayList<Date>();
                            l.add(date);
                            System.out.println(l.get(0).getTime()-l.get(1).getTime());

  2. #2
    itgalary's Avatar
    itgalary is offline Member
    Join Date
    Feb 2008
    Posts
    6
    Rep Power
    0

    Default

    May be the format specified is yy/MM/dd and the year uses 2007 which is yyyy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •