Here you can find the source of formatString2Date(String dateString)
public static final Date formatString2Date(String dateString)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static final Date formatString2Date(String dateString) { SimpleDateFormat sdf = new SimpleDateFormat(); Date datum = new Date(); try {//from w w w.j a va 2 s .co m datum = sdf.parse(dateString); return datum; } catch (ParseException e) { //logger.error(e.getMessage()); return null; } } public static final Date formatString2Date(String dateString, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); Date datum = new Date(); try { datum = sdf.parse(dateString); return datum; } catch (ParseException e) { //logger.error(e.getMessage()); return null; } } public static final Date formatString2Date(String dateString, String format, Locale locale) { SimpleDateFormat sdf = new SimpleDateFormat(format, locale); Date datum = new Date(); try { datum = sdf.parse(dateString); return datum; } catch (ParseException e) { //logger.error(e.getMessage()); return null; } } }