3 Replies Latest reply: Apr 10, 2008 9:13 AM by 807591 RSS

    How to validate a given date like April 9

    807591
      Hi All,

      I am stuck up validating date in the format April 9.

      Please find my code below:

      public static boolean isValidDateFormat(String date) {

      SimpleDateFormat sdf = new SimpleDateFormat("MMMM d");
      try {
      sdf.parse(date);
      } catch (ParseException e) {
      return false;
      }

      return true;
      }
      This is working fine but for invalid values like April 99, April -1, February 31 etc this is returning true. Is there any in built API's for validating this in JAVA