Android Utililty Methods Date String Parse

List of utility methods to do Date String Parse

Description

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

Method

DateparseDA(String s, boolean end)
parse DA
if (s == null || s.length() == 0)
    return null;
Calendar c = new GregorianCalendar();
c.clear();
if (end) {
    setToDec31(c);
parseDA(c, s, 0, s.length());
...
DateparseDT(String s, boolean end)
parse DT
if (s == null || s.length() == 0) {
    return null;
Calendar c = new GregorianCalendar();
c.clear();
if (end) {
    setToDec31(c);
    setTo2359(c);
...
DateparseDate(String atomPubDate)
parse Date
return parseDate(atomPubDate, Locale.getDefault());
DateparseDate(String atomPubDate, Locale locale)
parse Date
Date d = null;
SimpleDateFormat sdf;
for (int i = 0; i < DATE_FORMATS.length; i++) {
    sdf = new SimpleDateFormat(DATE_FORMATS[i], locale);
    sdf.setLenient(true);
    try {
        d = sdf.parse(atomPubDate);
        break;
...
DateparseDate(String date)
parse Date
if (date == null)
    return null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.parse(date);
DateparseDate(String date, SimpleDateFormat sdf)
parse Date
Date d = null;
sdf.setLenient(true);
try {
    d = sdf.parse(date);
} catch (ParseException e) {
    d = parseDate(date);
return d;
...
DateparseDate(String date, String format)
parse Date
if (date == null) {
    return null;
return parseDate(date,
        new SimpleDateFormat(format, Locale.getDefault()));
DateparseDate(String date, String pattern)
parse Date
if (date == null)
    return null;
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.parse(date);
DateparseDate(String date, String pattern)
Parses a date using a pattern describing the date and time format and the default TimeZone for this host.
return parseDate(date, pattern, TimeZone.getDefault());
DateparseDate(String date, String pattern, TimeZone zone)
Parses a date using a pattern describing the date and time format.
DateFormat dfmt = new SimpleDateFormat(pattern);
dfmt.setTimeZone(zone);
return dfmt.parse(date);