Java examples for java.util:Date Format
check Date YYYYMMDD
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static void main(String[] argv) throws Exception { String param = "java2s.com"; System.out.println(checkDateYYYYMMDD(param)); }// w ww.j a v a 2 s . c om public static SimpleDateFormat YMD_FORMAT = new SimpleDateFormat( "yyyy-MM-dd"); public static boolean checkDateYYYYMMDD(String param) { boolean bool = true; if (param == null || "".equals(param.trim())) { return false; } try { YMD_FORMAT.parse(param); } catch (ParseException e) { bool = false; } return bool; } }