title: Format date without dash?
body: <p>In Python, we can convert a date to a string by:</p>
  
  <pre><code>&gt;&gt;&gt; import datetime
  &gt;&gt;&gt; datetime.date(2002, 12,4).isoformat()
  '2002-12-04'
  </code></pre>
  
  <p>How can we format the output to be '20021204', i.e. without dashes?  </p>
  
  <p>There are  two functions, but I don't know how to specify the format:</p>
  
  <blockquote>
    <p><code>date.strftime(format)</code><br>
    Return a string representing the date,
    controlled by an explicit format string. Format codes referring to
    hours, minutes or seconds will see 0 values. For a complete list of
    formatting directives, see section <code>strftime()</code> and <code>strptime()</code> Behavior.</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p><code>date.__format__(format)</code><br>
    Same as <code>date.strftime()</code>. This makes it
    possible to specify format string for a date object when using
    <code>str.format()</code>. See section <code>strftime()</code> and <code>strptime()</code> Behavior.</p>
  </blockquote>