Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static Date parseDate(String val, String pattern) { try { return new SimpleDateFormat(pattern, Locale.getDefault()).parse(val); } catch (Exception e) { return null; } } }