Here you can find the source of convertToDate(String dateString)
Parameter | Description |
---|---|
ParseException | an exception |
public static Date convertToDate(String dateString) throws ParseException
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String DATEFORMAT = "yyyy-MM-dd"; /**/* w w w.j a v a 2 s .co m*/ * @throws ParseException * */ public static Date convertToDate(String dateString) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat(DATEFORMAT); Date date = sdf.parse(dateString); return date; } }