0

formatDuration?

The documentation for this function is slim. How is it supposed to work? I have tried giving it a number of seconds but it always puts out 00:00:00. Altering the format has no effect.

3replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Marc,
    The formatDuration function takes a duration in milliseconds and returns a formatted duration in the form "days HH:mm:ss"
    For example, formatDuration(443707000) takes the duration in milliseconds and returns "5d 03:15:00"

    Like
    • Dhatri Misra Thank you. I tried this with my second data and multiplied it by 1000 to convert to milliseconds and it isn't quite right. For example, I have raw data of 82 seconds. When using 82000 as the parameter, I get 00:01:00. I expect 00:01:22.

      I have manually implemented this using a formula that gives me exactly what I expect. This is the formula. It is quite extensive.

      concat(

          string(

              int(

                  floor(

                      AgentTimeDetail.AgentTimeDetail.LoginDurationSec / 3600

                  )

              )

          ),

          ":",

          string(

              int(

                  floor(

                      int(

                          floor(

                              AgentTimeDetail.AgentTimeDetail.LoginDurationSec - (int(

                                  floor(

                                      AgentTimeDetail.AgentTimeDetail.LoginDurationSec / 3600

                                  )

                              ) * 3600)

                          )

                      ) / 60

                  )

              )

          ),

          ":",

          string(

              int(

                  AgentTimeDetail.AgentTimeDetail.LoginDurationSec - ((int(

                      floor(

                          AgentTimeDetail.AgentTimeDetail.LoginDurationSec / 3600

                      )

                  ) * 3600)) - (int(

                      floor(

                          int(

                              floor(

                                  AgentTimeDetail.AgentTimeDetail.LoginDurationSec - (int(

                                      floor(

                                          AgentTimeDetail.AgentTimeDetail.LoginDurationSec / 3600

                                      )

                                  ) * 3600)

                              )

                          ) / 60

                      ) * 60

                  ))

              )

          )

      )

      Like
  • I have put in a ticket for this error. There is also a shorter version of the formula using the MOD() function. If anyone wants to see that, please reply and let me know.

    Like
Like Follow
  • Status Answered
  • 13 days agoLast active
  • 3Replies
  • 17Views
  • 2 Following