Decimals using datetime formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pablo
    Senior Member
    • Aug 2015
    • 177

    Decimals using datetime formula

    Hi!

    We have the following formula to calculate the number of days it takes to resolve each ticket:

    resolveDays = datetime\diff(resolveDate, createdAt, 'days');

    It works perfect. However, we would like to calculate this value with decimals to be more precise (example: 0.6 days, 1.5 days...).

    Can you help us modifying this formula to obtain decimal days?

    Thanks a lot!


  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hello,
    You can try something like this:
    Code:
    resolveDays = number\format(datetime\diff(resolveDate, createdAt, 'hours') / 24, 1);

    Comment

    • Pablo
      Senior Member
      • Aug 2015
      • 177

      #3
      Yes, yes, yes! It works PERFECT! Thanks a lot Maximus

      Merry Christmas!

      Comment

      • Zebrass
        Junior Member
        • Jan 2020
        • 1

        #4
        Originally posted by Maximus
        Hello,
        You can try something like this: telldunkin
        Code:
        resolveDays = number\format(datetime\diff(resolveDate, createdAt, 'hours') / 24, 1);
        Exactly what I needed! You just saved me several hours. Thanks!

        Comment

        Working...