title: How do I change a date to YYYYMMDD in Python?
body: <p>I have the below code which works out the date 6 months ago from todays date.</p>
  
  <pre><code>import datetime
  from dateutil.relativedelta import relativedelta
  from datetime import date
  
  six_months = date.today() + relativedelta(months=-6)  
  </code></pre>
  
  <p>However I would like six_months to be in "%Y%m%d" format.</p>
  
  <p>Thank you for your help.</p>