title: How to determine the numer of days between two dates?
body: <p>I'm having trouble figuring out how to check if a date is greater than 3 (or any number) of days. Please excuse the messy code, I am just trying to get it working before I go back and clean things up. This is what I have:</p>
  <pre><code>ticket_list = data['tickets']
  
  tickets = 0
  
  for t in ticket_list:
      status = ticket_list[tickets]['status']
      subject = ticket_list[tickets]['subject']
      if status == &quot;pending&quot;:
          ticket_id = str(ticket_list[tickets]['id'])
          ticket_metrics_url = &quot;https://{domain}.zendesk.com/api/v2/tickets/&quot; + ticket_id + &quot;/metrics.json&quot;
          ticket_metrics = requests.get(ticket_metrics_url, auth=(user, pwd))
          metrics_data = ticket_metrics.json()
          updated_time = metrics_data['ticket_metric']['requester_updated_at']
          updated_time = updated_time[0:10:1]
          now = str(datetime.now())
          now = now[0:10:1]
          if now &gt; updated_time:
              print(&quot;We are closing this ticket.&quot;)
  
      tickets += 1
  </code></pre>
  <p>So I am pulling a list of tickets, checking if they are pending, then if they are pending, I want to see if the last date the person responded was older than 3 days. If it is older than 3 days, I want to close the ticket. If it isn't over 3 days, I want to reply asking for an update.</p>
  <p>I just can't figure out how to make that last <code>if</code> statement checks if the ticket is over 3 days old. Since it is a string, I don't think I can perform any calculations on it, but I also don't know how to turn it back into an <code>int</code> that I could work with. Any ideas?</p>
  <p>Oh, to clarify, I turned the <code>updated_time</code> variable into a string so that I could try to match the format that I would get with <code>datetime.now()</code>. The <code>update_time</code> variable gives me a readout like this: <code>2020-11-17T20:15:13Z</code></p>
  <p>Preferably I'd like to check if it is older than 72 hours, but I wasn't sure how to do that either.</p>