Here you can find the source of toDate(String s)
public static Date toDate(String s) throws Exception
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class Main { static private DateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); public static Date toDate(String s) throws Exception { return sdf1.parse(s); }/* w w w . ja v a 2 s . co m*/ }