title: Range of date time compare in R for cutoff
body: <p>Good morning, sorry for the simple question, but I'm new to programming r and I don't know how to solve it. I read a csv file with the following data:</p>
  
  <pre><code>  smf30jbn jesnum ccode              end_day enddatetime initialtime interface cutoff-original
  1 DCDDDP00  14380   Sun 2020-03-15 17:07:181     2020-03-15 17:07:17 IN1233_01        07:00:00
  </code></pre>
  
  <p>I want to get this result:</p>
  
  <ol>
  <li><p>Add a new column with the name of the cutoff that has this format: <code>dd/mm/yyyy hh:mm:ss</code></p></li>
  <li><p>Get the difference between the new cutoff column and the <code>enddatetime</code> column</p>
  
  <p>With the following rules to manage the 24 hours:</p>
  
  <ul>
  <li>case1) if cutoff time> = 06:00:00 and &lt;= 23:59:59 on the same day</li>
  <li><p>case2) if cutoff time> = 00:00:00 and &lt;= 05:59:00 +1 day</p>
  
  <p>example:
  Day 16/03/2020 if cutoff = case1 the new column cutoff = 16/03/2020 + cutoff-original (hh:mm:ss)
  Day 16/03/2020 if cutoff = case2 the new column cutoff =
  3/17/2020 + cutoff-original (hh:mm:ss)</p></li>
  </ul></li>
  </ol>
  
  <p>Excuse me for my English . Thanks for all the help you can give me.</p>