title: Date selection using Selenium
body: <p>So I'm building a program that extracts data from several different websites that will display all our business data on a dashboard.</p>
  <p>I've managed to get to the point where I can extract the data I need, and have it set up to select todays data, previous week and month to date by importing datetime, and for the example of previous week the following:</p>
  <pre><code> date = datetime.date.today()
      yesterday = (date - datetime.timedelta(days = 1)).strftime('%d')
      lastWeek = (date - datetime.timedelta(days = 7)).strftime('%d')
      today = date.strftime('%d')
  </code></pre>
  <p>Then just using the find element function:</p>
  <pre><code>browser.find_element_by_link_text(lastWeek).click()
  </code></pre>
  <p>However I'm running into problems at the beginning of the month, where I can't subtract 7 as it would take me into negative numbers and wouldn't go to the previous months date as each month has different days etc.</p>
  <p>Is there any way of getting around this?</p>
  <p>TIA</p>