Removed Debug messages

This commit is contained in:
daniel oeh 2012-06-14 14:46:32 +02:00
parent ee9662e73d
commit ea6085723b
1 changed files with 12 additions and 20 deletions

View File

@ -12,14 +12,13 @@ public class SyndDateUtils {
public static final String RFC822 = "dd MMM yyyy HH:mm:ss Z"; public static final String RFC822 = "dd MMM yyyy HH:mm:ss Z";
/** RFC 822 date format with day of the week. */ /** RFC 822 date format with day of the week. */
public static final String RFC822DAY = "EEE, " + RFC822; public static final String RFC822DAY = "EEE, " + RFC822;
/** RFC 3339 date format for UTC dates. */ /** RFC 3339 date format for UTC dates. */
public static final String RFC3339UTC = "yyyy-MM-dd'T'HH:mm:ss'Z'"; public static final String RFC3339UTC = "yyyy-MM-dd'T'HH:mm:ss'Z'";
/** RFC 3339 date format for localtime dates with offset. */ /** RFC 3339 date format for localtime dates with offset. */
public static final String RFC3339LOCAL = "yyyy-MM-dd'T'HH:mm:ssZ"; public static final String RFC3339LOCAL = "yyyy-MM-dd'T'HH:mm:ssZ";
public static Date parseRFC822Date(final String date) { public static Date parseRFC822Date(final String date) {
Date result = null; Date result = null;
SimpleDateFormat format = new SimpleDateFormat(RFC822DAY); SimpleDateFormat format = new SimpleDateFormat(RFC822DAY);
@ -33,25 +32,17 @@ public class SyndDateUtils {
e1.printStackTrace(); e1.printStackTrace();
} }
} }
if (result != null) {
Log.d(TAG, "Day is " + result.getDay());
Log.d(TAG, "Hours is " + result.getHours());
Log.d(TAG, "Minutes is " + result.getMinutes());
Log.d(TAG, "Seconds is" + result.getSeconds());
Log.d(TAG, "Month is " + result.getMonth());
Log.d(TAG, "Year is " + result.getYear());
Log.d(TAG, format.format(result));
}
return result; return result;
} }
public static Date parseRFC3339Date(final String date) { public static Date parseRFC3339Date(final String date) {
Date result = null; Date result = null;
SimpleDateFormat format = null; SimpleDateFormat format = null;
if (date.endsWith("Z")) { if (date.endsWith("Z")) {
format = new SimpleDateFormat(RFC3339UTC); format = new SimpleDateFormat(RFC3339UTC);
try { try {
result = format.parse(date); result = format.parse(date);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -61,18 +52,19 @@ public class SyndDateUtils {
StringBuffer buf = new StringBuffer(date.length() - 1); StringBuffer buf = new StringBuffer(date.length() - 1);
int colonIdx = date.lastIndexOf(':'); int colonIdx = date.lastIndexOf(':');
for (int x = 0; x < date.length(); x++) { for (int x = 0; x < date.length(); x++) {
if (x != colonIdx) buf.append(date.charAt(x)); if (x != colonIdx)
buf.append(date.charAt(x));
} }
String bufStr = buf.toString(); String bufStr = buf.toString();
try { try {
result = format.parse(bufStr); result = format.parse(bufStr);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return result; return result;
} }
} }