Java unparseable date when using substrings

Here's the problem I am currently having I am writing a program that is getting info from a webpage table and the date for the first row is eg. "September 21, 2011". The subsequent rows then have the format of "September 28, 2011 (2011-09-28)". I am trying to substring the date but I keep getting Unparseable date: "September 21, 2011" whenever I do substring the string. If I don't substring the first date will work but the subsequent will crash and if I do even substring the first string it also crashes. String date = tableData.get(airDate).text(); int index = date.length(); if(date.contains("(")){ index = date.indexOf((int)'(') - 1; } date = date.substring(0, index); Date simpleDate = formatter.parse(date); My program is completely stuffed and I don't know why. Now I can no longer substring a string let along get the date to format right :(
How do you create your formatter ?

以上就是Java unparseable date when using substrings的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准