Here you can find the source of parseDateNoTimeWithDelimit(String sDate, String delimit)
public static Date parseDateNoTimeWithDelimit(String sDate, String delimit) throws ParseException
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public final static String shortFormat = "yyyyMMdd"; public static Date parseDateNoTimeWithDelimit(String sDate, String delimit) throws ParseException { sDate = sDate.replaceAll(delimit, ""); DateFormat dateFormat = new SimpleDateFormat(shortFormat); if ((sDate == null) || (sDate.length() != shortFormat.length())) { throw new ParseException("length not match", 0); }/*from w w w . ja v a 2s. c om*/ return dateFormat.parse(sDate); } }