title: Find weekday of a date given the month start weekday
body: <p>If X = weekday that the month started on (for example, this month would be 4, or Wednesday)</p>
  
  <p>Y = some other day of the month (for example, 21)</p>
  
  <p>Find Z, which is the weekday (1-7) of Y</p>
  
  <p>I thought this would work:</p>
  
  <pre><code>Z = (Y-X) % 7
  </code></pre>
  
  <p>In the example above Z = (21-4) % 7 = 3, which is correct (Oct. 21st is a Tuesday)</p>
  
  <p>But it fails for November 8th: Z = (8-7) % 7 = 1, incorrect because Nov. 8th is a Saturday (weekday=7).</p>
  
  <p>So what would be a robust formula for this?</p>
  
  <p>Note - I know there are NSDate utilities for finding the weekday of a date, but in this case all I know is X,Y as given above.</p>