Java Utililty Methods Parse Date

List of utility methods to do Parse Date

Description

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

Method

DateparseDateLoose(String dateString)
Convenience method for #parseDateStrict(String) which does not throw an exception on error, but merely returns null.
try {
    return parseDateStrict(dateString);
} catch (ParseException e) {
    return null;
DateparseDateNewFormat(String sDate)
parse Date New Format
DateFormat dateFormat = new SimpleDateFormat(newFormat);
Date d = dateFormat.parse(sDate);
return d;
DateparseDateNoTimeWithDelimit(String sDate, String delimit)
parse Date No Time With Delimit
sDate = sDate.replaceAll(delimit, "");
DateFormat dateFormat = new SimpleDateFormat(shortFormat);
if ((sDate == null) || (sDate.length() != shortFormat.length())) {
    throw new ParseException("length not match", 0);
return dateFormat.parse(sDate);
CalendarparseDateOrTimeString(String aDateString, String aFormatString)
parse Date Or Time String
Calendar tempCalendar = Calendar.getInstance();
tempCalendar.setTime(getSimpleDateFormat(aFormatString).parse(aDateString));
return tempCalendar;
DateparseDateRFC(String value)
parse Date RFC
if (value == null) {
    return null;
try {
    synchronized (sdf) {
        sdf.applyPattern(RFC_FORMAT);
        sdf.setTimeZone(GMT);
        return sdf.parse(value);
...
DateparseDateRfc822(String str)
Parse a string in RFC822 GMT format.
if (str != null) {
    try {
        SimpleDateFormat dateFormater = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
        dateFormater.setTimeZone(TimeZone.getTimeZone("GMT"));
        return dateFormater.parse(str);
    } catch (ParseException ex) {
        return null;
return null;
Date[]parseDates(String query)
parse Dates
String[] segments = SPLIT_PATTERN.split(query);
List<Date> dates = new ArrayList<>();
for (String s : segments) {
    Date date = parse(s.trim());
    if (date != null) {
        dates.add(date);
return dates.toArray(new Date[dates.size()]);
StringparseDateStrFormat(String strDate)
parse Date Str Format
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
return sdf.format(strDate);
DateparseDateString(String dateStr)
parse Date String
try {
    return dateformat.parse(dateStr);
} catch (ParseException e) {
    try {
        return new Date(dateStr);
    } catch (Exception e1) {
        return new Date();
DateparseDateString(String dateString)
parse Date String
Date d = null;
d = parseBingDate(dateString);
if (d != null)
    return d;
d = parseBossDate(dateString);
if (d != null)
    return d;
d = parseTwitterDate(dateString);
...