Java Date Parse convertStringToDate(String dateStr, String format)

Here you can find the source of convertStringToDate(String dateStr, String format)

Description

convert String To Date

License

Apache License

Parameter

Parameter Description
dateStr a parameter
format a parameter

Exception

Parameter Description
Exception an exception

Declaration

public static final Date convertStringToDate(String dateStr, String format) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**//ww w.  j av  a  2s. c o  m
     * 
     * @param dateStr
     * @param format
     * @return
     * @throws Exception
     */
    public static final Date convertStringToDate(String dateStr, String format) throws Exception {

        SimpleDateFormat sd = new SimpleDateFormat(format);
        Date pasrseDate = sd.parse(dateStr);

        return pasrseDate;
    }
}

Related

  1. convertStringToDate(String date)
  2. convertStringToDate(String date)
  3. convertStringToDate(String dateAsString)
  4. convertStringToDate(String dateFormat, String date)
  5. convertStringToDate(String dateInput, String formatter)
  6. convertStringToDate(String dateStr, String pattern)
  7. convertStringToDate(String dateString, String dateFormat)
  8. convertStringToDate(String dateString, String dateFormat)
  9. convertStringToDate(String dateString, String pattern)