title: Days_Between two dates
body: <p>I would like to ask how do i check if the difference between two dates.</p>
  
  <ol>
  <li><p>BillingDate which is a date type with an entry 'DD-MON-YYYY'</p></li>
  <li><p>and the other date is the current date.</p></li>
  </ol>
  
  <blockquote>
  <pre><code>sys_date - BillingDate = daysFromBilled
  </code></pre>
  </blockquote>
  
  <p>alot of the examples i find they actually stated the second date to calculate the difference but what i am looking for is the difference between the current date so i can add it into a schedule or job.</p>
  
  <p>i am using oracle btw.</p>
  
  <hr>
  
  <p>Another point to add, i will continue to search, but if your could also recommend, how should i implement such a function:</p>
  
  <ol>
  <li>Calculate date difference from all BillingDate entries</li>
  <li>To trigger an alter table if the difference is more than 30 days to put Status as Late.</li>
  <li>If Status is more than 60 days the Service attribute will be altered and changed to Cut</li>
  </ol>
  
  <p>here is my rough table layout</p>
  
  <pre><code>Cust             Billing
  --------         ----------
  CustID(PK)       BillingID(PK)
  LateStatus       LateStatus
  Service          BillingDate
                   CustID
  </code></pre>
  
  <p>Thanks alot.</p>
  
  <p>Update</p>
  
  <p>REPLACE view DateDifference as 
  select trunc(sysdate)- trunc(BillingDate)
  from Billing;</p>
  
  <p>seems legit.</p>