Here you can find the source of getDateFromString(String dateString)
public static Date getDateFromString(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 ENCOUNTER_DATE_PATTERN = "yyyy-M-d"; public static Date getDateFromString(String dateString) throws ParseException { // All csv imports use the same date format SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ENCOUNTER_DATE_PATTERN); simpleDateFormat.setLenient(false); return simpleDateFormat.parse(dateString); }/*from ww w . java 2s.c om*/ }