Here you can find the source of stringToDate(String strDate)
Parameter | Description |
---|---|
strDate | a parameter |
Parameter | Description |
---|---|
ParseException | an exception |
public static Date stringToDate(String strDate) throws ParseException
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from ww w . ja v a 2s.c om * Convert String to Date with MM/dd/yyyy format. * @param strDate * @return * @throws ParseException */ public static Date stringToDate(String strDate) throws ParseException { Date date = new SimpleDateFormat("MM/dd/yyyy").parse(strDate); return date; } }