The list of methods to do Year Parse are organized into topic(s).
Date
parseDashedDateDDMMYYYY(String date) Parses the specified date in dd-MM-yyyy format and returns the Date instance using the system default time zone.
SimpleDateFormat f = new SimpleDateFormat(DATE_FORMAT_DASHED_DD_MM_YYYY);
f.setTimeZone(TimeZone.getDefault());
return f.parse(date);
java.util.Date
parseDateyyyy_MM_DD2(String ds) parse DateyyyMDD
return new java.util.Date(new SimpleDateFormat(DATE_FORMAT_yyyy_MM_dd).parse(ds).getTime());
Date
parseDateyyyyMMdd(String value) Parse date in format yyyyMMdd.
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
return sdf.parse(value);
} catch (ParseException e) {
throw new IllegalArgumentException(
"Cannot parse date, value=[" + value + "]. Expected format is yyyyMMdd.", e);
int
parseTimeByYYYYMMDDHHMMSS(String str) parse Time By YYYYMMDDHHMMSS
if (str == null || str.length() != 19)
return 0;
try {
return (int) (yyyyMMddHHmmss.parse(str).getTime() / 1000L);
} catch (Exception ex) {
return 0;
Date
parseYYYYMMDD(String s) parse YYYYMMDD
try {
return (s == null) ? null : yyyymmdd.parse(s);
} catch (ParseException e) {
throw new RuntimeException(e);