Convert Minutes to Hour and Minutes

I have an app where the users are going to be putting in the START and END times for themselves (they will be driving).

https://nonstop-cobweb-9716.glideapp.io/

I know how to do the math and roll ups to get the total time in minutes.

So I have it set up to say “105 Minutes Total”

What do I need to do to have Glide spit out the sentence.

“1 Hour 45 Minutes Toal”

Can I do the math in GLIDE sheets? (preferred)

Is it something that I need to do in the Google Sheet?

Yes, you can do that with a combination of math and template columns.
Assume your Total (105) is in a column called Total:

  1. Create an Hours column as a math column using the formula FLOOR(T/60), and substitute T for Total
  2. Create a Minutes column as a math column using the formula MOD(T,60), and substitute T for Total
  3. Create a template column with your desired display text, substituting in the Minutes and Hours values as appropriate.

Hope this helps,
Darren

7 Likes

This looks pretty easy and straightfoward…

Just making sure … Is this in the GLIDE Sheets Data Editor?

Yes, that’s correct.

If you wanted to deal with the pluralisation of Hour vs Hours and Minute vs Minutes correctly, this could be done by adding a couple of if/then/else columns to output the singular or plural versions (ie. if hours = 1 then "hour" else "hours"), and then incorporate these extra columns into the template.

3 Likes

Hello Darren,

I know this is an old post but still very relevant to what I am looking to do. Hopefully you are still available to assist.

Is there a formula to do the reverse if I want to convert hours into minutes only? My angle is to use the “time stamp” and the “relative time” feature to shuffle cards. When the card is used it basically time stamps it and places most recently used cards at the end of the stack, ideally.

I have tried to understand the shuffle feature in the list of actions but I can’t seem to get it to work. Any help would be appreciated, thank you!

To convert hours into minutes, all you have to do is multiply then number of hours by 60. Then hours will become minutes.
hours*60

I think what might be better is to use a math column to subtract the timestamp from now. Then use the resulting duration values for sorting. You really shouldn’t have to “convert” anything. That way it will consider hours/minutes/seconds in your duration.
now-timestamp

2 Likes