Java Utililty Methods Date Parse

List of utility methods to do Date Parse

Description

The list of methods to do Date Parse are organized into topic(s).

Method

DategetDateFromString(String dateString)
get Date From String
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ENCOUNTER_DATE_PATTERN);
simpleDateFormat.setLenient(false);
return simpleDateFormat.parse(dateString);
DategetDateFromString(String dateString)
Returns a Date objected parsed from a given string representing a date.
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm");
try {
    Date date = dateFormat.parse(dateString);
    return date;
} catch (ParseException e) {
    System.out.println(dateString + " is unparseable using " + dateFormat);
return new Date();
...
DategetDateFromString(String dateString)
get Date From String
SimpleDateFormat format = new SimpleDateFormat(dateFormatString);
try {
    Date date = format.parse(dateString);
    return date;
} catch (Exception e) {
    throw new RuntimeException(e);
DategetDateFromString(String dateString, String format)
get Date From String
DateFormat formatter = new SimpleDateFormat(format);
return formatter.parse(dateString);
DategetDateFromString(String dateString, String format)
Gets date from string according to format provided.
Date finalResult = null;
DateFormat dateformat = new SimpleDateFormat(format);
finalResult = dateformat.parse(dateString);
return finalResult;
DategetDateFromString(String input, String format)
get Date From String
SimpleDateFormat sdf = new SimpleDateFormat(format);
try {
    return sdf.parse(input);
} catch (Exception ex) {
    return null;
DategetDateFromString(String iso, String format)
get Date From String
SimpleDateFormat sdf = new SimpleDateFormat(format);
sdf.setLenient(false);
try {
    return sdf.parse(iso);
} catch (ParseException e) {
    e.printStackTrace();
return null;
...
DategetDateFromString(String string)
get Date From String
Date date = new Date();
try {
    SimpleDateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss", Locale.ENGLISH);
    date = formatter.parse(string);
} catch (ParseException e) {
    e.printStackTrace();
return date;
...
DategetDateFromString(String stringDate, String format)
Purpose:
getDateFromString

Date date;
SimpleDateFormat sdf = new SimpleDateFormat(format);
try {
    date = sdf.parse(stringDate);
} catch (ParseException ex) {
    date = getNoDate();
return date;
...
DategetDateFromStringTest(String date)
get Date From String Test
SimpleDateFormat sdf = new SimpleDateFormat("dd/M/yyyy HH:mm:ss"); 
Date tDate = sdf.parse(date);
return tDate;