12 Replies Latest reply on May 4, 2016 11:50 PM by Rajeshwari Guddeti

    Time difference is displayed as negative

    Rajeshwari Guddeti

      Hello everyone,


      I have two dates, Start time and End time having Date&Time format.. I need to plot how many no.of alert_id's are generated in a given time range (I.e, between start time and end time).. I have used below calculation to get the time difference in seconds..

      (DATEPART('hour',DATETIME([End Time]))*3600+

      DATEPART('minute',DATETIME([End Time]))*60+

      DATEPART('second',DATETIME([End Time]))) -

      (DATEPART('hour',DATETIME([Start Time]))*3600+

      DATEPART('minute',DATETIME([Start Time]))*60+

      DATEPART('second',DATETIME([Start Time])))


      Now, so as to convert the time difference from seconds to HH:MM:SS format, I have used below calculation

      STR(INT(SUM([Convert to Seconds])/3600))+ ":" +

      IF LEN(STR(INT((SUM([Convert to Seconds])%3600)/60)))= 1 THEN "0" + STR(INT((SUM([Convert to Seconds])%3600)/60))

      ELSE STR(INT((SUM([Convert to Seconds])%3600)/60)) END + ":" +

      IF LEN(STR(INT(SUM([Convert to Seconds])%60)))= 1 THEN "0" + STR(INT(SUM([Convert to Seconds])%60))

      ELSE STR(INT(SUM([Convert to Seconds])%60))



      But when i implement the same calculation I'm getting time in negative difference as given below....


      Can someone help me in getting proper time difference and please help me with any ideas on how to plot the graph for providing visualizations which shows no.of alert values generated against given time range