Java String to Date stringToDate(String str, String formatStr)

Here you can find the source of stringToDate(String str, String formatStr)

Description

stringToDate.

License

Open Source License

Parameter

Parameter Description
str str
formatStr formatStr

Exception

Parameter Description

Return

Date

Declaration

public static Date stringToDate(String str, String formatStr) throws ParseException 

Method Source Code

//package com.java2s;

import java.text.*;
import java.util.*;

public class Main {
    /**/*from w w  w  .  ja v  a 2  s  . c  om*/
     * stringToDate.
     * @param str str
     * @param formatStr formatStr
     * @return Date
     * @throws java.text.ParseException 
     */
    public static Date stringToDate(String str, String formatStr) throws ParseException {
        DateFormat format = new SimpleDateFormat(formatStr);
        return format.parse(str);
    }
}

Related

  1. stringToDate(String source, String format)
  2. StringToDate(String str)
  3. stringToDate(String str)
  4. stringToDate(String str, String format)
  5. StringToDate(String str, String format)
  6. stringToDate(String strDate)
  7. stringToDate(String strDate)
  8. stringToDate(String strDate)
  9. stringToDate(String strDate)