Turn number (minutes) into counting time (days, hours; minutes)

Compared to my previous thread where we turn numbers from a data base to time in general; How to turn number (data) into counting time; Days; Hours, Minutes

…here we have the same number, but not in the data base, to turn it into the dynamic time number (days, hours, minutes).

Number is generated in the front end, and not existing in the data base.

How we can in this case display the time out of a number which is generated in the element?

Thanks!

1 Like

There might be a plugin for this but can you not just do the math?
297528/1440:rounded down = days
297528/1440:rounded down - 297528/1440 * -24:rounded down = hours
I’m too lazy to write out the last equation for the minutes but you get the idea.

2 Likes

If you were starting with data that was a timestamp then you could use custom formatting to display this easily.

But if you’re just starting with a number then doing the math would be the only way as @paul29 suggests.


Josh @ Support Dept
Helping no-code founders get unstuck fast :rocket:save hours, & ship faster with an expert :man_technologist: on-demand

1 Like

Hi @another,

If what you have is simply an integer representing a cumulative number of minutes, then one way to go about it is…

…where elapsed_minutes is just a custom state of type number containing the value 297528.

I would also probably make the values 1440 and 60 constants within an option set (as Minutes per day and Minutes per hour) to improve expression readability and eliminate the possibility of a typo.

(You could make use of Bubble’s date interval type, but it wouldn’t help much here unless you wanted to display total days or total hours as a fraction).

-Steve

1 Like

Thanks @paul29 @josh24 9 and @sudsy

Equation is known, while have though (On the page load) to use the state in a condition of the element from which to showcase the converted (minutes) into the wholistic time, but I thought to reach the data (when the page is loaded entirely) as well.

Interested from where @sudsy s fetching this “Text A” number.

Example: I have found this (“App Text (?)” feature, but am not sure about it, and how to use it?

1 Like

You can always “conesult” the documentation. :smirk: Although I’m not sure what that has to do with the issue you’re trying to solve.

I guess I misunderstood your original question entirely. Are you asking how to store the “total minutes” value so that it can be referenced multiple times? I assume you’re familiar with custom states and how to set/use them.

Perhaps you can rephrase the issue you’re facing as a simple question. I’m sorry, but I just don’t understand what you don’t understand. Might need more context. Perhaps someone else will jump in.

1 Like

Thanks for the answers you made here!

Yes, usage of custom states are very familiar to me.

Let us say this message is one (text) element, and here we have the following number: 429455 - that we need to turn into the Days; Hours; Minutes

On one hand we are unlucky, while on another we are lucky.

The good thing is that we have the number, and the bad thing is that this number is summarization of each user “online time” spent on the platform, so we actually don’t have a clear number in the data base, but it is summarized on the front end.

How we can now take the total number which is on the front end, and turn it into the Days; Hours; Minutes?

This topic was automatically closed after 70 days. New replies are no longer allowed.