Here you can find the source of convertStrToDate(String source)
public static Date convertStrToDate(String source)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date convertStrToDate(String source) { Date date = null;/*from w w w . j av a2 s . c o m*/ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setLenient(false); try { date = sdf.parse(source); } catch (ParseException e) { } return date; } }