title: Oracle Time Difference between SYSDATE and Date From Column
body: <p>I'm very new to Oracle. I have this problem, I got 365 days difference while these 2 dates' difference is are only one day.</p>
  
  <p>This is my SYSDATE Query Output:</p>
  
  <blockquote>
    <p>SELECT to_date(SYSDATE,'yyyy-MM-dd') FROM LOGINRECORDS</p>
  </blockquote>
  
  <p><code>15-OCT-11</code></p>
  
  <p>This is my date from column Query Output:</p>
  
  <blockquote>
    <p>SELECT to_date(LoginDate,'yyyy-mm-dd') FROM LOGINRECORDS WHERE LoginRecordId = '1000001'</p>
  </blockquote>
  
  <p><code>15-OCT-10</code></p>
  
  <p>And when I run this query :</p>
  
  <blockquote>
    <p>SELECT (to_date(SYSDATE,'yyyy-MM-dd') - to_date(LoginDate,'yyyy-MM-dd')) difference FROM LOGINRECORDS WHERE LoginRecordId = '1000001'</p>
  </blockquote>
  
  <p>I got this:</p>
  
  <p><code>365</code></p>
  
  <p>This is my table description :</p>
  
  <pre><code>CREATE TABLE LOGINRECORDS
  (
      LoginRecordId NUMBER GENERATED ALWAYS AS IDENTITY START WITH 1000000 INCREMENT BY 1,    
      LoginDate DATE,
      patientUserId NUMBER
  )
  </code></pre>
  
  <p>Hope you guys willing to help, Tq in advance.</p>