I need to parse a String that does not originally have the year set like
“13 Aug 11:30”
but when I output the date it adds the year on,
I tried set year but the year is totally wrong the output comes as “Thu Aug 13 11:30:00 GMT 3911”
Is there a way to set the year after the date is parsed?
SimpleDateFormat formatter = new SimpleDateFormat("dd MMM HH:mm");
String dateStr = "13 Aug 11:30";
Date fromDate = (Date)formatter.parse(dateStr);
fromDate.setYear(2011);
Use
Calendarto set the year: