Here you can find the source of stringToDate(String data)
public static Date stringToDate(String data)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static SimpleDateFormat format = new SimpleDateFormat( "dd/MM/yyyy"); public static Date stringToDate(String data) { Date retorno = new Date(); ;//from w ww. j a v a2s .c o m if (data != null && !data.equalsIgnoreCase("")) { try { retorno = format.parse(data); } catch (ParseException e) { e.printStackTrace(); } } else { retorno = null; } return retorno; } }