1 Reply Latest reply on Sep 27, 2016 8:58 AM by andreas.lindner

    Date Time difference in minutes


      Is it possible to get difference between two date time attributes in minutes usind calculation?

        • 1. Re: Date Time difference in minutes
          andreas.lindner Expert

          Hi Karthik,


          yes, absolutely. Just use a calculation like this:

          import System
          static def GetAttributeValue(Process):
               Timespan = EndDate - Startdate
               Value = Timespan.TotalMinutes


          The calculation explained:

          If you subtract two DateTime values, you'll get a Timespan value. The method .TotalMinutes will deliver the minutes and seconds of that timespan as Decimal number (e.g. 5 minutes and 30 seconds = 5,5). You can also use ".TotalSeconds" and other methods.

          And you can do any other calculations on that decimal number like round up or down if you like or convert them to a string for displaying on a window, etc.


          I hope that was what you wanted to do!