I have String like “Dec 31, 1969 4:00:00 PM”. I want to convert it to Date. I am using SimpleDateFormat. But it is giving me exception: java.lang.IllegalArgumentException: Unknown pattern character ‘Y’. How to solve it??
Date date ;
SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-YY HH:mm:ss");
date = (Date)formatter.parse(start);
Thanks.
Perhaps it should be small letter ‘y’ instead of capital one.
FYI, See: