Java String to Date stringToDateForIng(String date_str)

Here you can find the source of stringToDateForIng(String date_str)

Description

string To Date For Ing

License

Open Source License

Declaration

public static Date stringToDateForIng(String date_str) throws Exception 

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 {
    private static String datePatternForIng = "dd-MM-yyyy";

    public static Date stringToDateForIng(String date_str) throws Exception {
        SimpleDateFormat format = new SimpleDateFormat(datePatternForIng);
        try {/*from  w  w w . ja v  a  2s .  co  m*/
            return format.parse(date_str);
        } catch (ParseException e) {
            throw new Exception("errors.date.invalid");
        }
    }
}

Related

  1. stringToDate10(String date)
  2. stringToDateAndTime(final String dateAndTimeString)
  3. stringToDateByconf(String str, String formate)
  4. StringToDateByFormat(String dateStr, String formatStr)
  5. StringToDateByformat1(String time)
  6. StringToDateFormat(String str, String format)
  7. stringToDateInTimeZone(String time, String timeZone)
  8. stringToDateMetaData(String dateString)
  9. stringToDateTemporalCoverage(String dateString)