# Milliseconds to HH:mm:ss function

**URL:** https://community.mp3tag.de/t/milliseconds-to-hhss-function/61607
**Category:** Web Sources Discussion
**Created:** [July 18, 2023, 10:39pm UTC](https://community.mp3tag.de/t/milliseconds-to-hhss-function/61607 "2023-07-18T22:39:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [July 18, 2023, 10:39pm UTC](https://community.mp3tag.de/t/milliseconds-to-hhss-function/61607/1 "2023-07-18T22:39:08Z")

</div>

Beatport have this property ` "length": 779986`

I wonder is it too much to ask @Florian for a math fn to convert milliseconds to `HH:mm:ss`?

Thanks. I hope this is the last request.

* * *

This is to display a human-readable length in my TRACK scripts in the **List of search results**... dialog.

---

<div class="post-metadata">

### Author: ![thesuperintendent](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/4da419/32.png) [@thesuperintendent](https://community.mp3tag.de/u/thesuperintendent)
#### Post date: [July 19, 2023, 9:47am UTC](https://community.mp3tag.de/t/milliseconds-to-hhss-function/61607/2 "2023-07-19T09:47:17Z")

</div>

can't you use something like this, but adapt it to the json output obviously.

```auto
$div(%_length_seconds%,60):$num($mod(%_length_seconds%,60),2)

```

Just trying to think what would be already implementable with current functions.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [July 19, 2023, 10:22am UTC](https://community.mp3tag.de/t/milliseconds-to-hhss-function/61607/3 "2023-07-19T10:22:16Z")

</div>

I'm currently working on a dedicated function for that, both for standard scripting and the web sources framework.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [July 19, 2023, 8:41pm UTC](https://community.mp3tag.de/t/milliseconds-to-hhss-function/61607/4 "2023-07-19T20:41:30Z")

</div>

This is now part of [Mp3tag v3.21b](https://community.mp3tag.de/t/455) as a new function `SayDuration` which is not limited to JSON-handling, but can also be used in other contexts.

It takes the current input, interprets it as a numerical value and outputs a formatted duration string. It assumes to get the input in seconds, but can be switched to milliseconds via the optional second parameter `"ms"`

`SayDuration "ms"`
