Here you can find the source of stringDateToDate(String StrDate)
public static Date stringDateToDate(String StrDate) throws ParseException
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { static final String DATEFORMAT = "yyyy-MM-dd"; public static Date stringDateToDate(String StrDate) throws ParseException { Date dateToReturn = null; SimpleDateFormat dateFormat = new SimpleDateFormat(DATEFORMAT); try {//from ww w . j av a 2 s . c om dateToReturn = (Date) dateFormat.parse(StrDate); } catch (ParseException e) { e.printStackTrace(); } return dateToReturn; } }