Here you can find the source of convertToDate(String val)
public static Date convertToDate(String val) throws ParseException
//package com.java2s; /*/*from www.j a v a 2 s . com*/ * Distributable under LGPL v3 license. * See terms of license at https://github.com/Yunfeng/schotel/blob/master/LICENSE */ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date convertToDate(String val, String format) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.parse(val); } public static Date convertToDate(String val) throws ParseException { return convertToDate(val, "yyyy-MM-dd"); } }