Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-2692

Incorrect results with TIMESTAMPDIFF for months

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 7.7.7
    • Server
    • None

      The TimestampDiff counts months incorrectly:

      select TimestampDiff(SQL_TSI_MONTH, {d '2010-01-01'},{d '2015-01-01'}) --60 
      select TimestampDiff(SQL_TSI_MONTH, {d '2010-01-01'},{d '2016-01-01'}) --73 however the diff is 72(adding extra 1 month in 6th year)
      select TimestampDiff(SQL_TSI_MONTH, {d '2010-01-01'},{d '2017-01-01'}) --85 
      select TimestampDiff(SQL_TSI_MONTH, {d '2010-01-01'},{d '2022-01-01'}) --146 however the dff is 144 (adding extra 2 in 12 year)
      
       
      Year	Month	Expect	Teidd TimeStampDiff	   
      5	12	60	60	   
      6	12	72	73	   
      10	12	120	121	   
      11	12	132	133	   
      12	12	144	146	   
      13	12	156	158	   
      14	12	168	170	   
      15	12	180	182	   
      16	12	192	194	   
      17	12	204	206	   
      18	12	216	219
      

            rhn-engineering-shawkins Steven Hawkins
            adam.kovari Adam Kovari (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: