Java String to Date strToDate(String time, String format)

Here you can find the source of strToDate(String time, String format)

Description

Convert String of day to Date type

License

Open Source License

Parameter

Parameter Description
time a parameter
format a parameter

Exception

Parameter Description
ParseException an exception

Declaration

public static Date strToDate(String time, String format) throws ParseException 

Method Source Code


//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);
    }
}

Related

  1. strToDate(String strD)
  2. strToDate(String strDate)
  3. strToDate(String strDate)
  4. strToDate(String strDate)
  5. strToDate(String strDate, String format)
  6. strToDate3(String i_StrDate)
  7. strToDateM6(String StrToDate)
  8. StrToDateSeco(String str)
  9. strToDatetime(String sStr)