// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class CheckDate {
   private static DateFormat df = new SimpleDateFormat("yy-MM-dd");
    public static boolean isValidDate(String ds) throws ParseException {
      return ds.equals(df.format(df.parse(ds)));
    }
    private static void test(String ds) {
      try {
         System.out.println(ds + " " + isValidDate(ds));
      } catch (ParseException e) {
         e.printStackTrace();
      }
    }
   public static void main(String[] args) {
      test("03-04-10");
      test("03-13-32");
      test("03-02-29");
      test("04-02-29");
   }
}
