title: android how to identify the same days of a week
body: <p>To manage dates I'm using the class Calendar. I'm saving timestamps in a DB, using</p>
  
  <p><strong>Calendar timestamp = Calendar.getInstance();</strong></p>
  
  <p>I'm able to save and retrieve the dates from the DB using long values to store dates.</p>
  
  <p>This is my problem: when I have a timestamp to store, I need to know if in the DB there is already a timestamp belonging to the same week. To do this I thought I could use the couple of methods:</p>
  
  <p><strong>timestamp.get(Calendar.YEAR)</strong> and <strong>timestamp.get(Calendar.WEEK_OF_YEAR)</strong></p>
  
  <p>to uniquely identify a week, but this isn't true for weeks having days belonging to two consecutive years.</p>
  
  <p>This is an example of what I get for the last week of the year 2014.</p>
  
  <p><em>Saturday, December 27, 2014
  year: 2014
  week: 52</em></p>
  
  <p><em>Sunday, December 28, 2014
  year: 2014
  week: 1</em></p>
  
  <p><em>Monday, December 29, 2014
  year: 2014
  week: 1</em></p>
  
  <p><em>Tuesday, December 30, 2014
  year: 2014
  week: 1</em></p>
  
  <p><em>Wednesday, December 31, 2014
  year: 2014
  week: 1</em></p>
  
  <p><em>Thursday, January 1, 2015
  year: 2015
  week: 1</em></p>
  
  <p><em>Friday, January 2, 2015
  year: 2015
  week: 1</em></p>
  
  <p><em>Saturday, January 3, 2015
  year: 2015
  week: 1</em></p>
  
  <p><em>Sunday, January 4, 2015
  year: 2015
  week: 2</em></p>
  
  <p>The days from 28/12/2014 to 3/1/2015 belong to the same week (in java the week starts on Sunday), but they got a different year, so the couple (YEAR, WEEK_OF_YEAR) doesn't give me the info that they belong to the same week.</p>
  
  <p>How can I solve?</p>