I need to make sure that the users enters a date in the follow format: mm/dd/yyy
I've tried using a simple method to verify that if the parameter given is not null or empty, to check if it matches the required formatting, then if so, set that as the new date.
public void setDate(String dateIn) {
if ((dateIn != null) && !(dateIn.equals(""))) {
if (dateIn.equals("%2d" + "/" + "%2d" + "/" + "%4d")) {
validDate = dateIn;
}
}
}
The problem is in my second if statement, I just need to figure out how to make the method take numbers for the day, month, and year.