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

DateparseDate(String strFormat, String dateValue)
Parse a string and return the date value in the specified format
if (dateValue == null)
    return null;
if (strFormat == null) {
    strFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat dateFormat = new SimpleDateFormat(strFormat);
Date newDate = null;
try {
...
DateparseDate(String string)
parse Date
Date result = new Date();
DateFormat format = new SimpleDateFormat("M/d/y h:m a");
try {
    result = format.parse(string);
} catch (ParseException e) {
    e.printStackTrace();
return result;
...
DateParseDate(String string, String format)
Tries to parse string into a Date(+time), using given format.
try {
    return new SimpleDateFormat(format).parse(string);
} catch (ParseException exc) {
return null;
DateparseDate(String t)
Parse a date string
for (DateFormat df : DATE_FORMATS) {
    try {
        return df.parse(t);
    } catch (ParseException e) {
return null;
DateparseDate(String text)
parse Date
if (text == null)
    return null;
Matcher matcher = TZ_REGEX.matcher(text);
TimeZone timeZone = null;
if (matcher.find()) {
    String tzCode = "GMT" + matcher.group(1) + matcher.group(2); 
    timeZone = TimeZone.getTimeZone(tzCode);
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
if (timeZone != null) {
    formatter.setTimeZone(timeZone);
try {
    Date result = formatter.parse(text);
    return result;
} catch (ParseException e) {
    return null;
booleanparseDate(String text, String[] datePattern, int index)
parse Date
if (index == datePattern.length) {
    return false;
SimpleDateFormat format = new SimpleDateFormat(datePattern[index]);
format.setLenient(false);
try {
    format.parse(text);
    return true;
...
longparseDate(String time)
parse Date
if (time == null)
    return System.currentTimeMillis();
try {
    Date date = getDateFormat().parse(time);
    return date.getTime();
} catch (ParseException e) {
    return System.currentTimeMillis();
longparseDate(String time)
parse Date
try {
    return rfcFormat.parse(time).getTime();
} catch (ParseException e) {
    return isoFormat.parse(time).getTime();
DateparseDate(String timeString)
parse Date
sFormat = new SimpleDateFormat(DETAIL_TIME_FORMAT, Locale.CHINA);
try {
    return sFormat.parse(timeString);
} catch (ParseException e) {
    e.printStackTrace();
    return null;
DateparseDate(String token)
parse Date
Date retval = null;
try {
    retval = _DATE_FORMAT.parse(token);
} catch (final Exception e) {
    retval = null;
return retval;