title: How to substract/add minutes from a timestamp in postgreSQL
body: <p>I have the following scenario:</p>
  
  <p>I have employees who register their check in/out from their work. But they have 10 minutes of tolerance.</p>
  
  <p>The late entries I get with this view:</p>
  
  <pre><code>CREATE OR REPLACE VIEW employees_late_entries
  (
    id,
    created_datetime,
    entry_datetime,
    contact_id,
    contact_name,
    user_id,
    employees_perm_id
  )
  AS 
   SELECT precence_records.id,
      precence_records.created AS created_datetime,
      ("substring"(precence_records.created::text, 0, 11) || ' '::text) || contacts.entry_time::text AS entry_datetime,
      contacts.id AS contact_id,
      contacts.name AS contact_name,
      precence_records.user_id,
      precence_records.employees_perm_id
     FROM precence_records,
      contacts
    WHERE 
      precence_records.type::text = 'entry'::text AND 
      contacts.employee = true AND 
      contacts.id = precence_records.contact_id AND 
      ( ("substring"(precence_records.created::text, 0, 11) || ' '::text) || contacts.entry_time::text) &lt; precence_records.created::text AND 
      precence_records.employees_perm_id IS NULL;
  </code></pre>
  
  <p>the <code>precence_records.created</code> is the check in time and <code>contacts.entry_time</code> its the time of the schedule entry time for the employee.</p>
  
  <p>This is the <code>condition contacts.entry_time</code> vs <code>precence_records.created</code> to get the late entries:</p>
  
  <pre><code> ( ("substring"(precence_records.created::text, 0, 11) || ' '::text) || contacts.entry_time::text) &lt; precence_records.created::text
  </code></pre>
  
  <p>So I wanna do something like that:</p>
  
  <pre><code> (  ("substring"(precence_records.created::text, 0, 11) || ' '::text) || (contacts.entry_time::text + 10 MINUTES)  ) &lt; precence_records.created::text
  </code></pre>
  
  <p>DATA TYPES:</p>
  
  <p>precence_records.created TIMESTAMP
  contacts.entry_time VARCHAR</p>
  
  <p>Can you help me please</p>