Java Date Parse getDateFromString(String iso, String format)

Here you can find the source of getDateFromString(String iso, String format)

Description

get Date From String

License

Open Source License

Parameter

Parameter Description
iso -
format -

Return

-

Declaration

public static Date getDateFromString(String iso, String format) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    /**//from   www . j  av  a 2 s  . c  om
     * @param iso -
     * @param format -
     * @return -
     */
    public static Date getDateFromString(String iso, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        sdf.setLenient(false);
        try {
            return sdf.parse(iso);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. getDateFromString(String dateString)
  2. getDateFromString(String dateString)
  3. getDateFromString(String dateString, String format)
  4. getDateFromString(String dateString, String format)
  5. getDateFromString(String input, String format)
  6. getDateFromString(String string)
  7. getDateFromString(String stringDate, String format)
  8. getDateFromStringTest(String date)
  9. getDateFromText(String dateStr)