title: Ruby how can i get date of Monday after a given date
body: <p>Given A Day i-e Monday and a Date e.g: Sat, 09 Aug 2014</p>
  
  <p>how can i get the date of Monday coming immediately after given Date</p>
  
  <p><strong>Update:</strong></p>
  
  <pre><code>def get_date_after(date, day)
      return date if date.wday == day.to_date.wday
      days_difference = (date - day.to_date).to_i
      result = day.to_date + days_difference + (day.to_date.wday - date.wday)
      result = result + 1.week if result.to_date &lt; date
  end
  </code></pre>
  
  <p>I was looking for something like above method, calling it would return the date of the <strong>day</strong> passed coming immediately after the <strong>date</strong> passed </p>
  
  <pre><code>get_date_after(DateTime.parse("15/09/2014").to_date, "Wednesday") #=&gt; 17/09/2014
  </code></pre>