Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getDateFromString(String dateStr, String pattern) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); Date resDate = null; try { resDate = sdf.parse(dateStr); } catch (Exception e) { e.printStackTrace(); } return resDate; } }