What is the range of valid dates for the datetime module?
<p>I'm playing with the Python <a href="https://docs.python.org/2/library/datetime.html" rel="nofollow"><code>datetime</code></a> module. I'm using it to determine the day of the week for a given date. Python conveniently raises a <code>ValueError</code> when the date is invalid; e.g., for February 29 on non-leap years. </p>

<p>I have found that for years greater than 10,000 AD, <code>ValueError</code> exceptions are raised for many dates that are not February 29. This leads me to consider that the <code>datetime</code> module is not valid for dates that far in the future.</p>

<p><strong>What is the range of valid dates for the <code>datetime</code> module?</strong></p>

<p>Check <a href="https://docs.python.org/2/library/datetime.html#datetime.date.min"><code>date.min</code></a> and <a href="https://docs.python.org/2/library/datetime.html#datetime.date.max"><code>date.max</code></a>:</p>

<pre><code>&gt;&gt;&gt; from datetime import date
&gt;&gt;&gt; date.min
datetime.date(1, 1, 1)
&gt;&gt;&gt; date.max
datetime.date(9999, 12, 31)
</code></pre>

python date datetime calendar