Java examples for java.util:Date Format
Pass Date string in dd/MM/yyyy format
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getDate(String date) { SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); Date result = null;/*from w w w . j a v a 2s . co m*/ try { result = formatter.parse(date); } catch (ParseException e) { e.printStackTrace(); } return result; } }