Java tutorial
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static Date stringToDate4(String date) throws ParseException { DateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); Date _date = format.parse(date); return _date; } }