title: Getting a Specific Date Range
body: <p>I need to get a date range starting last Wednesday to yesterday. This program is run on every Wednesday. Is it the good way to do it? What if the program is run on a Tuesday for some reason? How do I make it work? Thanks.</p>
  
  <pre><code>Calendar calendar = Calendar.getInstance();
  calendar.add(Calendar.DAY_OF_MONTH, -7);
  Date transactionBeginDate = calendar.getTime();
  
  
  calendar = Calendar.getInstance();
  calendar.add(Calendar.DAY_OF_MONTH, -1);
  Date transactionEndDate = calendar.getTime();
  </code></pre>