Rounding Current Minutes to next :15 Minute

I need to show a next available time/opening in my prototype.

It needs to take the current time and round up to the next quarter-hour time (ie., next 15-minute mark: :00, :15, :30, or :45).

I haven’t found a way to do this yet (using Axure 8) and would appreciate any help here.

Thanks!

Hi @Jodeo,

use a “Set Text” action with the following formula:
:[[Now.getMinutes()-Now.getMinutes()%15+15]]

image

Here a prototype with the behaviour and a check for the possible values of minutes (0, 1, 2, … 59):
next-quarter.rp (50.0 KB)

Hope it will help you,
Best,

1 Like

Thanks!

Now… to add the hour (12-hour format)…
If I use it separately the prototype goes from 2:45pm to 2:00 pm (between 2:45-2:59). Then at 3 it goes to 3:15pm.

I clearly didn’t think that one through…

You could check the value of the minutes and if it’s 00 increments the hour value

Here a possible way to do it with text fields:
next-quarter_v2.rp (66.7 KB)

1 Like

Thanks for the assist. Unfortunately our company hasn’t OK’d upgrading to Axure 9 yet, so I’m still on 8.

I get the idea and will see if I can make that work.