Here you can find the source of convertStringToDate(String str)
Parameter | Description |
---|---|
str | a parameter |
public static Date convertStringToDate(String str)
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/* w w w. j ava 2 s . co m*/ * @param str * @return */ public static Date convertStringToDate(String str) { Date returnDate = null; DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); try { if (str != null) { returnDate = df.parse(str); } } catch (ParseException pe) { returnDate = new Date(); } return returnDate; } }