Here you can find the source of transformStringToDate(String dateString)
public static Date transformStringToDate(String dateString)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date transformStringToDate(String dateString) { Date date;/*from w w w . java 2s .c o m*/ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { date = simpleDateFormat.parse(dateString); } catch (ParseException e) { e.printStackTrace(); date = new Date(); } return date; } }