Java tutorial
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getDateByFormatDate(String dateString, String format) { SimpleDateFormat dateFormat = new SimpleDateFormat(format); Date date = null; try { date = dateFormat.parse(dateString); } catch (ParseException exception) { exception.printStackTrace(); } return date; } }