I want to compare two dates to categories Browser History... I have seen too many posts but didn't get any helpful,
My code is as :
 private static String calculateDate()
{
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DAY_OF_YEAR, -10);
    return simpleDateFormat.format(new Date(calendar.getTimeInMillis()));
}
private static String today()
{
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DAY_OF_YEAR,0);
    return simpleDateFormat.format(new Date(calendar.getTimeInMillis()));
}
public void getBHistory()
{
    long startdates = 0;
    long enddates = 0;
    Date endDate = null;
    Date startDate=null;
    try
    {
        startDate = (Date)new SimpleDateFormat("yyyy-MM-dd")
                .parse(calculateDate());
        endDate = (Date)new SimpleDateFormat("yyyy-MM-dd")
                .parse(today());
        startdates = startDate.getTime();
        enddates = endDate.getTime();
    } catch (ParseException e)
    {
        e.printStackTrace();
    }
    // 0 = history, 1 = bookmark
    String sel = Browser.BookmarkColumns.BOOKMARK + " = 0" + " AND "
            + Browser.BookmarkColumns.DATE + " BETWEEN ? AND ?";
    Cursor mCur = m_oContext.getContentResolver().query(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, sel,
            new String[]{
                    "" + startdates, "" + enddates
            }, null);
    mCur.moveToFirst();
    String title = "";
    String date_time = "";
    if (mCur.moveToFirst() && mCur.getCount() > 0)
    {
        while (!mCur.isAfterLast())
        {
            title = mCur.getString(mCur
                    .getColumnIndex(Browser.BookmarkColumns.TITLE));
            date_time = mCur.getString(mCur
                    .getColumnIndex(Browser.BookmarkColumns.DATE));
            SimpleDateFormat simpleDate= new SimpleDateFormat("yyyy-MM-dd");
            String curDate=simpleDate.format(new Date(Long.parseLong(date_time)));
            Toast.makeText(m_oContext,"History Time : "+curDate,Toast.LENGTH_SHORT).show();
            Toast.makeText(m_oContext,"Limit Time : "+calculateDate(),Toast.LENGTH_SHORT).show();
            //TODO: Compare these two dates here
            mCur.moveToNext();
        }
    }
} 
I want to do if the History date is earlier than ten days ago then notify the user. Any kind of help will be appreciated ,thank you.
 
     
     
     
     
     
    