Can you help me debug?
Parse won't convert my date to string. Here's my whole code
String newDate = "05252021";
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
Date today1 = new Date();
String dateToday = sdf.format(today1);
System.out.println("Date Now : " + dateToday);
int betweenDays = 0;
Date hireDate= sdf.parse(newDate); // error sdf.partse
long between = today1.getTime() - hireDate.getTime();
betweenDays = (int) (between / (24 * 60 * 60 * 1000));
Error encountered
Unhandled exception: java.text.ParseException
java.text.DateFormat public java.util.Date parse(String source) throws java.text.ParseException
Parses text from the beginning of the given string to produce a date. The method may not use the entire text of the given string. See the parse(String, ParsePosition) method for more information on date parsing.
Params: source – A String whose beginning should be parsed.
Returns: A Date parsed from the string.
Throws: java.text.ParseException – if the beginning of the specified string cannot be parsed