Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, Im trying to store in "2015-03-28 11:16:38" into my database from user input on a jsp.
but im getting this error - "java.text.ParseException: Unparseable date: "2015-03-28 11:16:38"

<br />
 String xDate = request.getParameter("timeRequested");<br />
                Date newDate = new SimpleDateFormat("yyyyMMdd HH:mm:ss", Locale.US).parse(xDate);<br />
                timeRequested = newDate;<br />


Any help or tips would be much appreciated.
Thanks.
Posted
Updated 26-Mar-15 1:26am
v2
Comments
Richard MacCutchan 26-Mar-15 7:32am    
Your string still does not match the format specified.

1 solution

Richard is right in his comment:

yyyy-MM-dd HH:mm:ss
2015-03-28 11:16:38


That matches.

good website to play around upon: http://www.fileformat.info/tip/java/simpledateformat.htm[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900