title: TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'int' object
body: <p>I've just encountered this issue, and couldn't find a reasonable answer for it on the front page of Google. It's similar to <a href="https://stackoverflow.com/questions/5619489/troubleshooting-descriptor-date-requires-a-datetime-datetime-object-but-rec">this question asked in 2011</a>, but for a newer version of Python, which results in a different error message.</p>
  <p>What is causing these <code>TypeError</code>s?</p>
  <h3>Integers</h3>
  <pre class="lang-py prettyprint-override"><code>import datetime
  my_date = datetime.datetime.date(2021, 3, 2) 
  </code></pre>
  <p>Results in the error:</p>
  <pre class="lang-none prettyprint-override"><code>TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'int' object
  </code></pre>
  <h3>Strings</h3>
  <p>Similarly, replacing the integers with strings also gives the same error:</p>
  <pre class="lang-py prettyprint-override"><code>import datetime
  my_date = datetime.datetime.date(&quot;2021&quot;, &quot;3&quot;, &quot;2&quot;) 
  </code></pre>
  <p>Gives:</p>
  <pre class="lang-none prettyprint-override"><code>TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'str' object
  </code></pre>
  <h3>Lists</h3>
  <p>And using a list gives the same error:</p>
  <pre class="lang-py prettyprint-override"><code>import datetime
  my_date = datetime.datetime.date([2021, 3, 2]) 
  </code></pre>
  <p>Results in:</p>
  <pre class="lang-none prettyprint-override"><code>TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'list' object
  </code></pre>
  <p>Similarly, using <code>from datetime import datetime</code> and <code>datetime.date</code> will result in the following error messages respectively:</p>
  <pre class="lang-none prettyprint-override"><code>TypeError: descriptor 'date' for 'datetime' objects doesn't apply to a 'int' object
  </code></pre>
  <pre class="lang-none prettyprint-override"><code>TypeError: descriptor 'date' for 'datetime' objects doesn't apply to a 'str' object
  </code></pre>
  <pre class="lang-none prettyprint-override"><code>TypeError: descriptor 'date' for 'datetime' objects doesn't apply to a 'list' object
  </code></pre>