6 Replies Latest reply: Nov 12, 2014 6:18 PM by Daniel Oberbillig RSS

    Converting Seconds to hh:mm:ss format without using Interval() function

    Vladimir Komarov



      I have a data set where some time values are presented in seconds. Data on the chart should be displayed in hh:mm:ss format.

      I've used the Interval() function in the script:

           Interval(time_field/86400, 'hh:mm:ss') as TIME_VALUE

      and everything was looking good.



      I need to avoid any data transformation in my script and simply rely on data from the database.


      I was hoping that using the same approach on the data side (code from the View Script):

           CAST (TIME_SEC / 84600 AS NUMBER (20, 18)) AS TIME_FULL

      will work the same way, but I've noticed some rounding (?) issues.

      With small values in seconds, everything looks good:


      With values growing, the error increases:



      And the difference reaches significant values when time in seconds represent large interval (more than 2 minutes difference in ~1,5 hours range....):



      I could not find any reasonable explanation for that.



      I would appreciate any suggestions.