Author | Message |
---|---|
Amedrano
Posts: 80
|
Posted 18:31 Nov 10, 2014 |
I'm getting
when I try to parse a String from a parameter into a date. what am I doing wrong exactly? |
xytian
Posts: 70
|
Posted 18:37 Nov 10, 2014 |
check this line: CheckOutItem.java:95 |
raywu64
Posts: 44
|
Posted 19:03 Nov 10, 2014 |
I think it has to be something in this form:
|
xytian
Posts: 70
|
Posted 19:07 Nov 10, 2014 |
I think you have to do some conversion in order to tell whether an item is overdue or not. Research about SimpleDateFormat to make sure your are parsing the string correctly. https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html Last edited by xytian at
19:07 Nov 10, 2014.
|
Amedrano
Posts: 80
|
Posted 19:13 Nov 10, 2014 |
I'd like for them to be "Date" objects in order to compare them. I did the conversion using "SimpleDateFormat" called "ft" String dueBackDate = request.getParameter( "dueBackDate" ); Last edited by Amedrano at
19:15 Nov 10, 2014.
|
raywu64
Posts: 44
|
Posted 19:22 Nov 10, 2014 |
I think the problem with that is that SimpleDateFormat requires the time as well. Try finding a simpler date object for this homework.
You can also split the string date and parse the string integers, then compare using a few if statements |
xytian
Posts: 70
|
Posted 19:25 Nov 10, 2014 |
What's your df? To parse string as you described, df should look like DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); ------------------------------------------------------------ I just looked at the assignment and it should be "M/d/yyyy" Last edited by xytian at
19:33 Nov 10, 2014.
|
Amedrano
Posts: 80
|
Posted 19:32 Nov 10, 2014 |
I think you meant "ft" SimpleDateFormat ft = new SimpleDateFormat( "M/d/yyyy " ); |
xytian
Posts: 70
|
Posted 19:37 Nov 10, 2014 |
You have a space in "M/d/yyyy " |
Amedrano
Posts: 80
|
Posted 19:41 Nov 10, 2014 |
oh wow...I think that was the problem. thank you |