import android.net.Uri;
import android.provider.BaseColumns;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
return sdf.format(date);
}
+ /**
+ * Converts a dateText to a long Unix time representation
+ * @param dateText the input date string
+ * @return the Date object
+ */
+ public static Date getDateFromDb(String dateText) {
+ SimpleDateFormat dbDateFormat = new SimpleDateFormat(DATE_FORMAT);
+ try {
+ return dbDateFormat.parse(dateText);
+ } catch ( ParseException e ) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+
// Possible paths (appended to base content URI for possible URI's)
// For instance, content://com.example.android.sunshine.app/weather/ is a valid path for
// looking at weather data. content://com.example.android.sunshine.app/givemeroot/ will fail,