Java Utililty Methods Parse Date Pattern YYYY

List of utility methods to do Parse Date Pattern YYYY

Description

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

Method

Dateparse(String dateString)
Parse the given date string to date object and return a date instance based on the given date string.
String dateFormat = determineDateFormat(dateString);
if (dateFormat == null) {
    throw new ParseException("Unknown date format.", 0);
return parse(dateString, dateFormat);
Dateparse(String dateString)
Parse the given date string to date object and return a date instance based on the given date string.
String dateFormat = determineDateFormat(dateString);
if (dateFormat == null) {
    throw new ParseException("Unknown date format.", 0);
if (dateFormat.equals("MM/dd/yyyy")) {
    Date d = null;
    try {
        d = parse(dateString, dateFormat);
...
Dateparse(String dateString)
parse
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(rfc822DateFormat);
Date parsedDate = null;
try {
    parsedDate = simpleDateFormat.parse(dateString);
} catch (ParseException e) {
    throw new IllegalArgumentException("Unable to parseMultipart '" + dateString
            + "' into a date using format '" + rfc822DateFormat + "'");
return parsedDate;
Dateparse(String dateString, String dateFormat)
Validate the actual date of the given date string based on the given date format pattern and return a date instance based on the given date string.
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);
simpleDateFormat.setLenient(false); 
return simpleDateFormat.parse(dateString);
Calendarparse(String dateText)
Converst a String in the format "yyyy-MM-dd" to a Calendar object.
try {
    Calendar result = Calendar.getInstance();
    result.setTime(DATE_FORMAT.parse(dateText));
    return result;
} catch (NullPointerException | ParseException e) {
    return null;
Dateparse(String ds)
Parse the date string using the default date format.
return parse(ds, _DEFAULT_DATE_FORMAT_);
Dateparse(String format, String val)
Parse a String val based on the string format provided.
if (val == null || val.trim().length() == 0)
    return null;
validateDate(val, format);
SimpleDateFormat formatter = new SimpleDateFormat(format);
formatter.setLenient(false);
return formatter.parse(val);
Dateparse(String input)
Try and evaluate the string and return a date
try {
    return new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(input);
} catch (Exception e) {
try {
    return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(input);
} catch (Exception e) {
try {
    return new SimpleDateFormat("yyyy-MM-dd").parse(input);
} catch (Exception e) {
try {
    return new SimpleDateFormat("yyyy/MM/dd").parse(input);
} catch (Exception e) {
try {
    return new SimpleDateFormat("dd MMM yyyy").parse(input);
} catch (Exception e) {
try {
    return new SimpleDateFormat("dow mon dd hh:mm:ss zzz yyyy").parse(input);
} catch (Exception e) {
try {
    return new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy").parse(input);
} catch (Exception e) {
try {
    return new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy").parse(input);
} catch (Exception e) {
return null;
Calendarparse(String original)
Parses strings the way that CVS supports it...
return parse(original, Locale.getDefault());
Dateparse(String param)
parse
Date date = null;
SimpleDateFormat sdf = new SimpleDateFormat(patternDate);
try {
    date = sdf.parse(param);
} catch (Exception ex) {
    ex.printStackTrace();
return date;
...