Android Utililty Methods Date String to Date Convert

List of utility methods to do Date String to Date Convert

Description

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

Method

CalendarparseCalDav(String date)
parse Cal Dav
if (date == null || date.equals(""))
    return null;
GregorianCalendar temp = new GregorianCalendar();
temp.setTime(caldavFormat.parse(date));
return temp;
CalendarparseCalDavDue(String date)
parse Cal Dav Due
return parseDate(date, caldavDueFormat);
CalendarparseDBDateTime(String date)
parse DB Date Time
return parseDate(date, dbDateTimeFormat);
CalendarparseDate(String date)
parse Date
return parseDate(date, dateFormat);
CalendarparseDate(String date, SimpleDateFormat format)
parse Date
if (date == null || date.equals(""))
    return null;
GregorianCalendar temp = new GregorianCalendar();
temp.setTime(format.parse(date));
return temp;
DateparseDate(String dateString)
parse Date, "yyyy-MM-dd HH:mm"
SimpleDateFormat sdf = new SimpleDateFormat(
        FORMAT_DATE_AND_TIME_YYYY_MM_DD_HH_MM);
try {
    return sdf.parse(dateString);
} catch (Exception e) {
    e.printStackTrace();
    return null;
CalendarparseDateTime(String date)
parse Date Time
return parseDate(date, dateTimeFormat);
CalendarparseTaskWarrior(String date)
parse Task Warrior
return parseDate(date, taskwarriorFormat);
DategetDate(String sDate, String dateFormat)
get Date
SimpleDateFormat fmt = new SimpleDateFormat(dateFormat);
ParsePosition pos = new ParsePosition(0);
return fmt.parse(sDate, pos);
DateconvertStringToDate(String dateString, String currentFormat)
used to convert the specified date string to Date instance
SimpleDateFormat dateFormat = new SimpleDateFormat(currentFormat,
        Locale.getDefault());
return dateFormat.parse(dateString);