Java calendar
in
Programming Questions
•
1 year ago
Hi
I'm relatively new to processing (and code in general) and trying to learn to use Java libraries. I found an example online but it gives an error, and I can't tell why.
The error is "unhandled exception type ParseException" Here's the code:
-
import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date;
String dateInput = "10/31/1999";Calendar cal = Calendar.getInstance();SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");Date date = sdf.parse(dateInput);cal.setTime(date);System.out.println("Day Of Week: " + cal.get(Calendar.DAY_OF_WEEK));
Any ideas would be greatly appreciated, thanks!
1