datetime - Date(String) parse error in Java -
I paste the following lines of code to parse string
as a date I'm using
:
string display birthday; ... java.util.Date ss1 = new date (display birthday); SimpleDateFormat formatter5 = New SimpleDateform ("YY-MM-DD"); DisplayBirthday = formatter5.format (SS1); Li.add (displayBirthday);
It works fine for many dates, but when I want to parse the date like: 0001-03-10
This gives me the following error :
java.lang.IllegalArgumentException: parse error: 0001-03-10
I am using a prefix of 0001 for those dates Which is not a year in the form of internal representation. How to overcome this?
is the boycott of
date (java.lang.String) '', just Use SimpleDateFormat
Just like this
SimpleDateFormat formatter5 = New SimpleDateFormat ("yyyy-MM-dd"); String DisplayBirdde = Format 5 Format (Formater 5. Paras ("0001-03-10"); Println (displayBirthday);
Excluded:
0001-03-10
Comments
Post a Comment