| Author |
java.text.ParseException: Unparseable date: ""
|
jatinkumar patel
Greenhorn
Joined: Apr 19, 2009
Posts: 23
|
|
Need help with parsing date. I am new to parsing of date.
Thanks for help
Eoor i am getting
|
 |
Mahesh Lohi
Ranch Hand
Joined: Jun 22, 2009
Posts: 150
|
|
In
Private static SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy",Locale.US);
I think parsing of MM-dd-yyyy is not posible ("-"). Remove "-" then try it.
To manipulate using the date, use ("MMddyyyy",Locale.US);
If you are not manipulating the data then, don't have to parse.
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
In
Private static SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy",Locale.US);
I think parsing of MM-dd-yyyy is not posible ("-"). Remove "-" then try it.
To manipulate using the date, use ("MMddyyyy",Locale.US);
If you are not manipulating the data then, don't have to parse.
Its possible to parse date of any format as long as the date matches the format that you are trying to parse.
Here the problem is date is empty and you are trying to parse it.
First understand the use of parse method , it takes String as argument in the format as passed SimpleDateFormat 's constructor and returns corresponding date object.
|
 |
Mahesh Lohi
Ranch Hand
Joined: Jun 22, 2009
Posts: 150
|
|
|
Thank you I didn't know it
|
 |
jatinkumar patel
Greenhorn
Joined: Apr 19, 2009
Posts: 23
|
|
Thanks Balu Sadhasivam and Mahi Lohi for quick reply.
I made the mistake of parsing NULL value, Henceforth i was getting the previous mentioned exception.
So did the following
Thanks for meaningful and quick help.
|
 |
 |
|
|
subject: java.text.ParseException: Unparseable date: ""
|
|
|