Python check if date is within 24 hours
<p>I have been trying some code for this, but I can't seem to completely wrap my head around it.</p>

<p>I have a set date, <code>set_date</code> which is just some random date as you'd expect and that one is just data I get.
Now I would like some error function that raises an error if <code>datetime.now()</code> is within 24 hours of the <code>set_date</code>.</p>

<p>I have been trying code with the <code>timedelta(hours=24)</code></p>

<pre><code>from datetime import datetime, timedelta

now = datetime.now()
if now &lt; (set_date - timedelta(hours=24)):
    raise ValidationError('')
</code></pre>

<p>I'm not sure whats right to do with this, what the good way to do is. How exactly do I check if the current time is 24 hours before the set date?</p>