Here you can find the source of strToDate(String dateInString)
Parameter | Description |
---|---|
dateInString | a parameter |
public static Date strToDate(String dateInString)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from w w w. j a va 2s . c om * Convierte una fecha tipo string a un tipo Date * @author Esther Flores Rodriguez (esther.fr03@gmail.com) * @param dateInString * @return newDate */ public static Date strToDate(String dateInString) { Date newDate = null; SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); if (dateInString != null) { try { newDate = sdf.parse(dateInString); } catch (ParseException ex) { ex.printStackTrace(); } } return newDate; } }