Here you can find the source of toDate(String dateString)
public static Date toDate(String dateString)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import com.google.common.base.Strings; public class Main { private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); public static Date toDate(String dateString) { if (Strings.isNullOrEmpty(dateString)) { return null; }// w w w .j a v a 2s . c o m try { return DATE_FORMAT.parse(dateString); } catch (ParseException e) { throw new RuntimeException(e); } } }