# Convert time

**URL:** https://community.glideapps.com/t/convert-time/77259
**Category:** Ask for Help
**Created:** [October 22, 2024, 4:01pm UTC](https://community.glideapps.com/t/convert-time/77259 "2024-10-22T16:01:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![agung\_taufik1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/agung_taufik1/32/80541_2.png) [@agung\_taufik1](https://community.glideapps.com/u/agung_taufik1)
#### Post date: [October 22, 2024, 4:01pm UTC](https://community.glideapps.com/t/convert-time/77259/1 "2024-10-22T16:01:35Z")

</div>

Hi, how do I convert hours, minutes and seconds?  
example 08:22:10  
to 8 hours 22 minutes 10 seconds

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/3/f322ff456e3991b248b9bd7e6c959b4c7f5d4b3f.png)

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [October 22, 2024, 4:36pm UTC](https://community.glideapps.com/t/convert-time/77259/2 "2024-10-22T16:36:41Z")

</div>

I’ve used [Chuck’s](https://community.glideapps.com/t/chuck-norris-aka-jeff/26818) solution before

> [@Time duration not presenting correctly in glide chart stopwatch](https://community.glideapps.com/t/time-duration-not-presenting-correctly-in-glide-chart/24014/6):
>
> I took it a step further and included Days as well. You can exclude it if you don’t need it. It’s a little involved, but I’ll explain the best I can. Here is my results: First we have the Duration column, which is obvious and what you already have. Next we have the Days column: FLOOR(D)/100 This is simply taking the duration and dropping off the decimals. The division by 100 will be explained later. Next we have the Hours column: FLOOR(MOD(D,1)\*24)/100 Th…

---

<div class="post-metadata">

### Author: ![micheal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/micheal/32/80181_2.png) [@micheal](https://community.glideapps.com/u/micheal)
#### Post date: [October 22, 2024, 4:56pm UTC](https://community.glideapps.com/t/convert-time/77259/3 "2024-10-22T16:56:56Z")

</div>

Do try Jeff’s solution out you’ll learn a thing from there (I already have)

Also I made a JS code for this case

```auto
function convertTime(p1) {
  p1 = p1.replace(/(AM|PM)$/i, "").trim();

 
  let timeParts = p1.split(":");

  if (timeParts.length === 2) {
    timeParts.push("00");
  }
  
  else if (timeParts.length === 1) {
    timeParts.push("00", "00");
  }

  const [hours, minutes, seconds] = timeParts;

  
  const formattedHours = Number(hours);
  const formattedMinutes = Number(minutes);
  const formattedSeconds = Number(seconds);

  
  const hourLabel = formattedHours === 1 ? "hour" : "hours";
  const minuteLabel = formattedMinutes === 1 ? "minute" : "minutes";
  const secondLabel = formattedSeconds === 1 ? "second" : "seconds";

  
  return `${formattedHours} ${hourLabel} ${formattedMinutes} ${minuteLabel} ${formattedSeconds} ${secondLabel}`;
}

return convertTime(p1);

```

if this doesn’t work with the date column it needs only a time value, the date columnn doesn’t provide a time only value, so you can pass this to a template column. That said it’s possible to parse the cell and get just the time
