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

Calendarparse(String source)
Null-safe method to create a Calendar from a formatted String .
Calendar cal = Calendar.getInstance();
cal.setTime(df.parse(source));
return cal;
Dateparse(String source)
parse
if (source.equalsIgnoreCase("today")) {
    return new Date();
if (source.equalsIgnoreCase("yesterday")) {
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DATE, -1);
    return cal.getTime();
try {
    return DATE_FORMAT.parse(source);
} catch (ParseException e) {
    return null;
Dateparse(String source, Date defaultValue)
parse
try {
    return parse(source, "yyyy-MM-dd HH:mm:ss");
} catch (Exception e) {
    return defaultValue;
Dateparse(String str)
parse
if (str.length() != DATE_PATTERN.length() && str.length() != DATE_TIME_PATTERN.length()) {
    return null;
String formatPattern = DATE_PATTERN;
if (str.length() > 10) {
    formatPattern = DATE_TIME_PATTERN;
try {
...
Dateparse(String str)
parse
SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
try {
    if (str.length() < INIT_DATE_TIME.length()) {
        str += INIT_DATE_TIME.substring(str.length() + 1);
    return sdf.parse(str);
} catch (ParseException e) {
    return null;
...
Dateparse(String str)
parse
DateFormat fmt = new SimpleDateFormat(DATE_FORMAT);
try {
    return fmt.parse(str);
} catch (ParseException e) {
    throw new IllegalArgumentException("Invalid date format", e);
longparse(String str)
parse
int len = str.length();
String date = str.substring(0, 10);
Long baseline = map.get(date);
if (baseline == null) {
    try {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        format.setTimeZone(TimeZone.getTimeZone("GMT+8"));
        baseline = format.parse(date).getTime();
...
Dateparse(String str)
parse
return getISO8601DateFormat().parse(str);
Dateparse(String strDate)
parse
return parse(strDate, getDatePattern());
Dateparse(String strDate)
parse
if (null == strDate || "".equals(strDate)) {
    return null;
try {
    return parseISO8601(strDate);
} catch (ParseException exp) {
    return parseRFC2616(strDate);