# Getting Hours/Minutes/Seconds separately

**URL:** <https://forum.adalo.com/t/getting-hours-minutes-seconds-separately/7554>\
**Category:** Get Help\
**Created:** [January 3, 2021, 5:34am UTC](https://forum.adalo.com/t/getting-hours-minutes-seconds-separately/7554 "2021-01-03T05:34:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![djack](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@djack](https://forum.adalo.com/u/djack)\
**Post date:** [January 3, 2021, 5:34am UTC](https://forum.adalo.com/t/getting-hours-minutes-seconds-separately/7554/1 "2021-01-03T05:34:46Z")

</div>

I am using the timer component and saving the total time it was used into to my collection. Now I want to sum the time saved for the day. I am saving the milliseconds as well as the text hours:minutes:seconds from the timer component. So if I saved 1:30 and 5:35 when I sum the two I should get 7 minutes and 5 seconds. Currently I can only sum the total milliseconds and I can convert it but then I cannot have x minutes and x seconds. It turns out to be 7.05. How do I split that up to read 7 minutes and 5 seconds? or x hours, x minutes , x seconds? Or is that even possible right now?

---

<div class="post-metadata">

**Author:** ![CopyThat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/copythat/32/2705_2.png) [@CopyThat](https://forum.adalo.com/u/CopyThat)\
**Post date:** [January 3, 2021, 6:26pm UTC](https://forum.adalo.com/t/getting-hours-minutes-seconds-separately/7554/2 "2021-01-03T18:26:33Z")

</div>

Following! I would like to know the answer too

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [January 4, 2021, 6:28pm UTC](https://forum.adalo.com/t/getting-hours-minutes-seconds-separately/7554/3 "2021-01-04T18:28:20Z")

</div>

Hi @djack,

If you store 1:30 and 5:35 as a _text_ records, then it would be difficult to split them into minutes&seconds without using extra services. I think Integromat string functions might help.

I would suggest storing the total time in milliseconds in a collection record, and then convert them to hours-minutes-seconds to display them. I’ve created a small POC how to convert milliseconds, pretty simple, here are the screenshots:

The app screen itself

 ![Screenshot 2021-01-04 at 21.12.12](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/c/c0c67b6eca001a75bd93ee78aea592a22a98234f.png)

I’ve created 4 properties to store Hours, Minutes, and Seconds, and the fourth one is to store initial value in seconds (see the left side of the screenshot). All property names start with EX20. First step is “Update User” action where I store the seconds value.

 ![Screenshot 2021-01-04 at 21.12.32](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/9/9a9440251a8a80fc822258100fc443b109e7a324.png)

And the logic itself: here I calculate Hours, Minutes & Seconds.  
With hours it is simple: to get number of hours, I take the integer part of Total Seconds divided by 3600.  
To get the remaining minutes, I need to put away the hours from the initial Total seconds, and then divide the remaining by 60, and take the integer part of it.  
And the same logic applies to seconds - I put away the number of minutes.

 ![Screenshot 2021-01-04 at 21.12.46](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/1/1643c1674b2712fa37ad94d14a986bb4d7a32f82.png)

This should work correctly, as per my checks.

Best,  
Victor.

---

<div class="post-metadata">

**Author:** ![djack](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@djack](https://forum.adalo.com/u/djack)\
**Post date:** [January 4, 2021, 7:21pm UTC](https://forum.adalo.com/t/getting-hours-minutes-seconds-separately/7554/4 "2021-01-04T19:21:04Z")

</div>

This is exactly what what I was trying to do. I am saving to milliseconds and was converting to seconds but could not figure out how to get rid of the remaining digits after the decimal. Thanks so much for your help. I wish I would have asked sooner.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/system/32/40401_2.png) [@system](https://forum.adalo.com/u/system)\
**Post date:** [January 14, 2021, 7:21pm UTC](https://forum.adalo.com/t/getting-hours-minutes-seconds-separately/7554/5 "2021-01-14T19:21:08Z")

</div>

Closed on January 14, 2021, 7:21pm UTC

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