Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date StringToDate(String str) { SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd"); Date d = null; try { d = sim.parse(str); } catch (ParseException e) { System.out.println(e.getMessage().toString()); } return d; } }