# How to format seconds to duration HH:MM

**URL:** https://community.glideapps.com/t/how-to-format-seconds-to-duration-hh-mm/50847
**Category:** Ask for Help
**Created:** [October 4, 2022, 10:46am UTC](https://community.glideapps.com/t/how-to-format-seconds-to-duration-hh-mm/50847 "2022-10-04T10:46:56Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![KPT](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@KPT](https://community.glideapps.com/u/KPT)
#### Post date: [October 4, 2022, 10:46am UTC](https://community.glideapps.com/t/how-to-format-seconds-to-duration-hh-mm/50847/1 "2022-10-04T10:46:56Z")

</div>

I’ve been using the below example using a javascript column to convert seconds to a date format.

> [@Convert Seconds to Duration](https://community.glideapps.com/t/convert-seconds-to-duration/40820/2):
>
> You can use this in a JavaScript column.
> 
> ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/5/f5a62a88be818326ddbc26035e235216ae88e7ba.png)
> 
> ```auto
> return new Date(p1 * 1000).toISOString().substr(11, 8)
> 
> ```
> 
> Original answer:

Does anyone know how to change the the format to HH:MM instead of HH:MM:SS - I’ve looked around the internet, but no luck.

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [October 4, 2022, 11:13am UTC](https://community.glideapps.com/t/how-to-format-seconds-to-duration-hh-mm/50847/2 "2022-10-04T11:13:37Z")

</div>

That JavaScript method is a bit of a hack. Here is a better option:

> [@Format duration in minutes as hh:mm](https://community.glideapps.com/t/format-duration-in-minutes-as-hh-mm/36430):
>
> This is a classic example of where a single experimental code column can save you a bunch of Glide computed columns. My use case: I have a column where the value in each row represents a duration in minutes, and I need to format that for display as hh:mm. So, for example… 2914 =\> 48:34 804 =\> 13:24 63 =\> 01:03 5 =\> 00:05 0 =\> blank As far as I could tell, none of the plugin columns will handle this. But it looks easy, right? Well, the best I could do with Glide computed columns was 6 (!!) …

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [October 4, 2022, 11:15am UTC](https://community.glideapps.com/t/how-to-format-seconds-to-duration-hh-mm/50847/3 "2022-10-04T11:15:47Z")

</div>

use the format date column:

 ![Screen Shot 2022-10-04 at 7.15.02 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/b/eb561de642879b253126759f8a994e9e38760037.png)

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [October 4, 2022, 11:25am UTC](https://community.glideapps.com/t/how-to-format-seconds-to-duration-hh-mm/50847/4 "2022-10-04T11:25:15Z")

</div>

Except when it [doesn’t work…](https://community.glideapps.com/t/time-format/50074/8)

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [October 4, 2022, 11:27am UTC](https://community.glideapps.com/t/how-to-format-seconds-to-duration-hh-mm/50847/5 "2022-10-04T11:27:46Z")

</div>

I belive he just wants to display it… for any other purposes, use the math column

---

<div class="post-metadata">

### Author: ![KPT](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@KPT](https://community.glideapps.com/u/KPT)
#### Post date: [October 4, 2022, 11:31am UTC](https://community.glideapps.com/t/how-to-format-seconds-to-duration-hh-mm/50847/6 "2022-10-04T11:31:59Z")

</div>

Yes you’re right just for display purpose.

---

<div class="post-metadata">

### Author: ![KPT](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@KPT](https://community.glideapps.com/u/KPT)
#### Post date: [October 4, 2022, 11:32am UTC](https://community.glideapps.com/t/how-to-format-seconds-to-duration-hh-mm/50847/7 "2022-10-04T11:32:17Z")

</div>

Works like a charm.  
Thank you.

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)
#### Post date: [October 5, 2022, 11:32am UTC](https://community.glideapps.com/t/how-to-format-seconds-to-duration-hh-mm/50847/8 "2022-10-05T11:32:33Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
