Here you can find the source of getDate(String time)
public static Date getDate(String time)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getDate(String time) { Date date = new Date(System.currentTimeMillis()); SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); try {/* w w w .j ava 2 s . co m*/ date = format.parse(time); } catch (ParseException e) { e.printStackTrace(); } return date; } }