Here you can find the source of strToDate(String time, String format)
Parameter | Description |
---|---|
time | a parameter |
format | a parameter |
Parameter | Description |
---|---|
ParseException | an exception |
public static Date strToDate(String time, String format) throws ParseException
//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. ja va 2 s .c o m*/ * Convert String of day to Date type * * @param time * @param format * @return * @throws ParseException */ public static Date strToDate(String time, String format) throws ParseException { DateFormat formater = new SimpleDateFormat(format); return formater.parse(time); } }