Displaying hours and minute remaining today

Hello,

I think the title and my screenshots say it all…
-How to display hours and minute remaining between two dates?
-how to set up the progress bar (current progress= now; max= end of the day)?

HELP :slight_smile: please

Have a nice night



I would convert it to a percentage, or some kind of easy number. If you calculating the number of minutes between now and the end of the day, then you can divide that by the number of minutes in a workday.

For example: let’s say there are 8 hours in a workday (480 minutes). If there are two hours left in a day, then that’s 120 minutes.
120/480 = 0.25 or 25%.

Set the min on the progress bar to 0 and the max to 1. At the beginning of the day, you’ll have 1 or greater than 1, and by the end of the day, you’ll have 0 or less than zero.

If you want to take out some math, set the max to 480 and get rid of the division. Just set the current value to the number of minutes different between now and the end time.

3 Likes

If you are asking about getting a properly formatted date column for your end date and time, then you might be able to get away with setting your column that contains 23:30 to a date type column instead of a text column. Keep in mind that this method will set the day to the nearest date that contains that time. So after 23:30, the date difference may be negative until now is closer to 23:30 of the next day.

Thanks Jeff :pray:
Well copied for the progress bar.

But yes im also stuck at the first step lol:

Get time difference between NOW and END of the day (set by user on preferences screen).

I get this weird number: -298,123,20
Instead of what i want: 17 (17minutes between NOW and END of day)

Maybe im using wrong computed column? Or this number can be transformed in minutes somehow lol.

It would be useful if you showed us how you got that result (ie. a screen shot).

To get the difference between two datetime values in minutes, you can use the following math formula:

Trunc((EOD - Now) * 1440)

3 Likes

It seems that you are trying to use the template column as a date to calculate your time difference. The problem, is that the template column is just text. It’s not a valid date, even though it may look like it.

If you change your user enteres time column to a date type column, then you should be able to use that in your date difference column, or in a math column like @Darren_Murphy has shown. Either should work.

Most importantly, get rid of the template column because you don’t need it, and it wouldn’t work for anything anyway.

2 Likes

Thank you guys !
Will try asap and let you know if i managed to level up lol…

(I did provide a screenshot of my column “date difference” that gets me this number)

1 Like

Hello,

Thanks to both of you, most of the work is done.No surprise.

Just: my user will need to set the end of the day as a time? for always.
Im talking here about UI.

in user profile page he/she will set : end of the day.

But i want him to deal ONLY with a time visually.
the choice or dat/time component should show:
19:00
and not 07/12:22 19:00

(that explain a bit my try earlier with template column etc…)

Thanks

Yes, that would work best.

What if they could select from a pre-generated list of times in a choice component - would that work?
What you could do is use a Helper Table with two columns. One would contain a list of human readable times, something like “5pm, 5:30pm, 6pm, etc”, and the second column could contain the corresponding datetime values. The values in the second column could be auto generated using a bit of date math. So your choice component could display the values in the first column, and write the values from the second column.

Would that work?

3 Likes

Genius idea!

Inside the maths column(the value of the choice component) what would be the magic formula please?

Today+ ?

As We need to display the computed current day, with the time set by the user.

——————

Im thinking now… of an option?
I try tom to find step 4 lol

1/End time text colum: from Choice component to set a time value inside. (Choices from a List of fix time values as Darren said)

3/Template column ( maths current day column + time value text

4/ ???

5/ proper date/time column (constructed)

Let me make an example for you. What would be the time range you would want (eg 4pm min to 7pm max), and what intervals (eg. 15min, 30 min)?

Thanks Darren…
A good template is worth a thousand of words lol

Interval of 30 then. Its faster for you?
once understood i can modify later…

The possible end date range:
10am to 12pm.

(Some people like me do deep work on short period of time… like from 6am to 10 am)

Have a nice day!

oops, too late I already made the video. But I explained how it’s done, so you should be able to adjust:

Formulas that I used:

Min time:

Now
- Hour(Now)/24
- Minute(Now)/1440
- Second(Now)/86400
+ 15/24

For your case, you would change the last line to 10/24

Actual time:

Min + 15/1440 * Index

To get 30 min intervals, you would change that to 30/1440

2 Likes

Double thanks:

1/ working perfectly

2/i understood (not only copy) so new skills for me - no price on that.

Bonus: i know how to find and display a row number! ( no direct fct for that in glide table - yet)
I think it will help me with that:

And some screenshots for the ones that will get the same challenge we had here.




Screenshot 2022-12-08 at 16.10.30

1 Like

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