title: want to retrieve values from a give range of dates from database
body: <p>I want to fetch values in the following manner:</p>
  
  <p>I want to fetch the total value for current weeks count and my code is here:</p>
  
  <pre><code>SimpleDateFormat weekDateFormat = new SimpleDateFormat("dd/MM/yyyy");
  Calendar c = Calendar.getInstance();
  c.set(Calendar.DAY_OF_WEEK, 1);
  Date weekFirstDate = c.getTime();
  String strWeekFirstDay = weekDateFormat.format(weekFirstDate);
  Cursor weekCursor = database.rawQuery("select sum(cat_attribute_unit) from counter where cat_id ="+cat_id+" AND counter_entry_date BETWEEN '"+strWeekFirstDay+"' AND '"+todays_date+"';", null);
  int weekCounter = 0;
  if(weekCursor.moveToFirst())
      weekCounter = weekCursor.getInt(0);
  else
      weekCounter = 0;
  weekCursor.close();
  </code></pre>
  
  <p>And this is the code for fetching current month's total count:</p>
  
  <pre><code>SimpleDateFormat monthDateFormat = new SimpleDateFormat("dd/MM/yyyy");
      Calendar c2 = Calendar.getInstance();
      c2.set(Calendar.DAY_OF_MONTH, 1);
      Date monthFirstDate = c2.getTime();
      String strMonthFirstDay = monthDateFormat.format(monthFirstDate);
  
      Cursor monthCursor = database.rawQuery("select sum(cat_attribute_unit) from counter where cat_id ="+cat_id+" AND counter_entry_date BETWEEN '"+strMonthFirstDay+"' AND '"+todays_date+"';", null);
      int monthCounter = 0;
      if(monthCursor.moveToFirst())
          monthCounter = monthCursor.getInt(0);
      else
          monthCounter = 0;
      monthCursor.close()
  </code></pre>
  
  <p>is this correct ?? because its not working properly, means i get wrong values. Also i want to make my week start from Monday. Would anyone pls correct my code or suggest some new code.</p>