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

CalendarparseString2Calendar(String date)
parse String Calendar
return parseString2Calendar(date, null);
DateparseString2Date(String date)
parse String Date
return parseString2Date(date, null);
DateparseString2Date(String sDate, String format)
parse String Date
if (format == null || "".equals(format)) {
    format = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.parse(sDate);
LongparseString2Long(String strDate)
parse String Long
return new Long(parseDate(strDate, FORMAT_STR_TIME).getTime());
DateparseStringAsDate(String pattern, String value)
parse String As Date
try {
    SimpleDateFormat formatter = new SimpleDateFormat(pattern);
    return (value == null) ? null : formatter.parse(value);
} catch (Exception e) {
    return null;
DateparseStringDate(String dateAsString)
Parses a text date in a thread-safe way.
synchronized (CU_PROPERTY_DATE_PARSER) {
    return CU_PROPERTY_DATE_PARSER.parse(dateAsString);
StringparseStringDateToRmFormat(String date)
Convert String from dd.MM.yyyy to yyyy-MM-dd.
SimpleDateFormat sdfOld = new SimpleDateFormat("dd.MM.yyyy");
SimpleDateFormat sdfNew = new SimpleDateFormat("yyyy-MM-dd");
Date d;
try {
    d = sdfOld.parse(date);
} catch (ParseException e) {
    e.printStackTrace();
    return null;
...
DateparseStringForDate(String dateString)
parse String For Date
String[] dateFormats = new String[] { "yyyy-MM-dd'T'HH:mm", "yyyy-MM-dd" };
for (int i = 0; i < dateFormats.length; i++) {
    Date date = attemptParse(dateString, dateFormats[i]);
    if (date != null) {
        return date;
return null;
...
CalendarparseStringToCalendar(String strDate)
parse String To Calendar
java.util.Date date = parseStringToUtilDate(strDate);
if (date == null) {
    return null;
Calendar ca = Calendar.getInstance();
ca.setTime(date);
return ca;
DateparseStringToDate(final String pDate, final String... pFormat)
parse String To Date
final DateFormat dateFormat;
if (pFormat.length == 0) {
    dateFormat = new SimpleDateFormat(DEFAULT_FORMAT);
} else {
    dateFormat = new SimpleDateFormat(pFormat[FORMAT_POSITION]);
final Date parsedDate;
try {
...