7 Replies Latest reply: Apr 9, 2007 12:44 PM by 796440 RSS

    Date validation in dd/mm/yyyy format

    807606
      hi,
      I am using SimpleDateFormat to validate date but it not working properly It is not validating against date range and leap year.

      String stringDate = "40/02/1999";

      try
      {
      SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
      ParsePosition pos = new ParsePosition(0);
      Date date = formatter.parse(stringDate, pos);
      System.out.println("correct");
      }
      catch (Exception e)
      {
      e.printStackTrace();
      }