Here you can find the source of strToDate(String date)
public static Date strToDate(String date) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.util.Date; public class Main { public static Date strToDate(String date) throws ParseException { java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd"); java.util.Date d = sdf.parse(date); return d; }/* w w w . j av a2 s.c o m*/ }