0

This is my designservlet.java, I got error unparsable date,how to fix this?

SimpleDateFormat reFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
Date activityDate = (Date) reFormat.parse(request.getParameter("startDate"));

I tried this from last few days but cannot solve this......... here, i also want to add date in database, i write code for this also...

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
sarojni Gupta
  • 21
  • 1
  • 7
  • You receive the string `12/8/2014` as parameter, and try to parse it using the pattern `yyyy-MM-dd'T'HH:mm:ss.SSS'Z`. How could it possibly work? The pattern obviously doesn't match with the date, does it? – JB Nizet Jan 23 '16 at 17:54
  • I got this error after adding pattern.. – sarojni Gupta Jan 23 '16 at 17:58
  • HTTP Status 500 - Unterminated quote type Exception report message Unterminated quote description The server encountered an internal error that prevented it from fulfilling this request. exception java.lang.IllegalArgumentException: Unterminated quote java.text.SimpleDateFormat.compile(Unknown Source) – sarojni Gupta Jan 23 '16 at 17:58
  • So, how dd you change your code? Have you read the error message and tried to make sense of it? – JB Nizet Jan 23 '16 at 18:01
  • what changes should I do ?, I do not know.. – sarojni Gupta Jan 23 '16 at 18:05
  • I'm sorry, but you need to apply common sense, and read the documentation of SimpleDateFormat. What do you think yyyy, MM, dd, etc. mean in the string passed to new SimpleDateFormat()? Do you understand that code, or did you copy and paste it without trying to understand it? http://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html – JB Nizet Jan 23 '16 at 18:11

0 Answers0