Here you can find the source of parseString(String strDate)
public static String parseString(String strDate) throws ParseException
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String defaultDatePattern = "yyyy-MM-dd"; public static String defaultDatePattern1 = "yyyy-MM-dd HH:mm:ss"; public static String parseString(String strDate) throws ParseException { if (strDate == null || "".equals(strDate)) { return null; }//from ww w . ja v a2 s .c o m if (strDate.length() > 19) { strDate = strDate.substring(0, 19); } Date bufferDate = parse(strDate, defaultDatePattern1); return format(bufferDate); } public static Date parse(String strDate) throws ParseException { return parse(strDate, getDatePattern()); } public static Date parse(String strDate, String pattern) throws ParseException { SimpleDateFormat df = new SimpleDateFormat(pattern); return df.parse(strDate); } public static String format(Date date) { return format(date, getDatePattern()); } public static String format(Date date, String pattern) { String returnValue = ""; if (date != null) { SimpleDateFormat df = new SimpleDateFormat(pattern); returnValue = df.format(date); } return (returnValue); } public static String getDatePattern() { return defaultDatePattern; } }