Just don’t know why this snippet is not correct.
Calendar now = Calendar.getInstance();
DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
String nowDate1 = formatter.format(now.getTime());
Date nowDate = formatter.parse(nowDate1);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Based on your comments, your are not including the try / catch sentences:
As parse() could throw a ParseException at runtime, the compiler is warning you about it, and that is why you need to consider the possibility of a ParseException.