Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getDateFromString(String strDate) { try { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date date = format.parse(strDate); return date; } catch (ParseException e) { return null; } } }