# Total length in templates

**URL:** <https://community.mp3tag.de/t/total-length-in-templates/19135>\
**Category:** Support\
**Created:** [July 11, 2017, 6:39pm UTC](https://community.mp3tag.de/t/total-length-in-templates/19135 "2017-07-11T18:39:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LKA](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/9fc348/32.png) [@LKA](https://community.mp3tag.de/u/LKA)\
**Post date:** [July 11, 2017, 6:39pm UTC](https://community.mp3tag.de/t/total-length-in-templates/19135/1 "2017-07-11T18:39:59Z")

</div>

So I've been using the export feature a lot using a following template:

> $filename(txt,utf-8)$loop(%\_path%)%track%. %title% (%\_length%) $loopend() Total length: %\_total\_time%

It works mostly fine but there is something bugging me about the last line. It returns something like this:

> Total length: 00:42:42

Is there any way of removing the "00:" before the length for albums that are less than hour long? How would I achieve that?  
Thanks for helpping out in advance 🙂

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 12, 2017, 3:13am UTC](https://community.mp3tag.de/t/total-length-in-templates/19135/2 "2017-07-12T03:13:46Z")

</div>

> [@LKA](#):
>
> ...  
> Is there any way of removing the "00:" before the length for albums that are less than hour long? How would I achieve that?  
> Thanks for helpping out in advance 🙂

You could use  
$ifgreater($num($left(%\_total\_time%,2),1),0,%\_total\_time%,$mid(%\_total\_time%,4,$len(%\_total\_time%)))

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [July 12, 2017, 3:36am UTC](https://community.mp3tag.de/t/total-length-in-templates/19135/3 "2017-07-12T03:36:09Z")

</div>

> [@LKA](#):
>
> ... Total length: %\_total\_time% ... Is there any way of removing the "00:" before the length for albums that are less than hour long? How would I achieve that? ...

$ifgreater(%\_total\_seconds%,3600,%\_total\_time%,$right(%\_total\_time%,5))  
'12:34:56' ==\> '12:34:56'  
'00:34:56' ==\> '34:56'  
'00:04:56' ==\> '04:56'  
'00:00:56' ==\> '00:56'  
'00:00:06' ==\> '00:06'

... or ...

$ifgreater(%\_total\_seconds%,3600,%\_total\_time%,$trimLeft(%\_total\_time%,'0:'))  
'12:34:56' ==\> '12:34:56'  
'00:34:56' ==\> '34:56'  
'00:04:56' ==\> '4:56'  
'00:00:56' ==\> '56'  
'00:00:06' ==\> '6'

DD.20170712.0758.CEST

---

<div class="post-metadata">

**Author:** ![LKA](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/9fc348/32.png) [@LKA](https://community.mp3tag.de/u/LKA)\
**Post date:** [July 12, 2017, 4:05pm UTC](https://community.mp3tag.de/t/total-length-in-templates/19135/4 "2017-07-12T16:05:26Z")

</div>

> [@ohrenkino](#):
>
> You could use  
> $ifgreater($num($left(%\_total\_time%,2),1),0,%\_total\_time%,$mid(%\_total\_time%,4,$len(%\_total\_time%)))

> [@DetlevD](#):
>
> $ifgreater(%\_total\_seconds%,3600,%\_total\_time%,$right(%\_total\_time%,5))  
> '12:34:56' ==\> '12:34:56'  
> '00:34:56' ==\> '34:56'  
> '00:04:56' ==\> '04:56'  
> '00:00:56' ==\> '00:56'  
> '00:00:06' ==\> '00:06'
> 
> ... or ...
> 
> $ifgreater(%\_total\_seconds%,3600,%\_total\_time%,$trimLeft(%\_total\_time%,'0:'))  
> '12:34:56' ==\> '12:34:56'  
> '00:34:56' ==\> '34:56'  
> '00:04:56' ==\> '4:56'  
> '00:00:56' ==\> '56'  
> '00:00:06' ==\> '6'
> 
> DD.20170712.0758.CEST

Thanks a lot guys, both of these work perfectly fine 🙂

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:26pm UTC](https://community.mp3tag.de/t/total-length-in-templates/19135/5 "2026-02-09T12:26:53Z")

</div>


