Java tutorial
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static Date getDate(String stringDate) { DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH); Date date = null; try { date = format.parse(stringDate); } catch (ParseException e) { } return date; } }