Here you can find the source of StringToDate(String s)
public static Date StringToDate(String s) throws ParseException
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static Date StringToDate(String s, String pattern) throws ParseException { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); return simpleDateFormat.parse(s); }/* www . j a v a2s . co m*/ public static Date StringToDate(String s) throws ParseException { return StringToDate(s, "yyyy-MM-dd hh:mm:ss"); } }