Skip to main content
Participant
March 1, 2023
Answered

Slider Control Expression - Count up 15 minutes

  • March 1, 2023
  • 1 reply
  • 2338 views

Hey there, 

 

i want to use a slider control expression to count up every 15 min from 06:00am to 18:00pm.

 

Start:  06:00

06:15; 06:30; 06:45; 07:00: 07:15; 07:30 ...

End: 18:00

 

Is there anyway to skip the numbers?

 

My actuall Expression shows all 10 steps.

 

slider = Math.round(effect("Slider Control")("Slider"))      
sec = slider%60 
x = Math.floor(slider/60)
min= x%60
hour = Math.floor(slider/3600)
function addZero(n){ if (n<10) return "0" + n else return n } 
addZero(hour) + ":" + addZero(min) + ":" + addZero(sec)

 

Thanks for your help!

 

Best regards

Kevin

Correct answer Dan Ebberts

Try it this way:

slider = Math.floor(effect("Slider Control")("Slider")/15)*15;      
sec = slider%60;
x = Math.floor(slider/60);
min= x%60;
hour = Math.floor(slider/3600);
function addZero(n){ return (n<10) ? "0" + n : n } 
addZero(hour) + ":" + addZero(min) + ":" + addZero(sec)

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
March 1, 2023

Try it this way:

slider = Math.floor(effect("Slider Control")("Slider")/15)*15;      
sec = slider%60;
x = Math.floor(slider/60);
min= x%60;
hour = Math.floor(slider/3600);
function addZero(n){ return (n<10) ? "0" + n : n } 
addZero(hour) + ":" + addZero(min) + ":" + addZero(sec)
Kevin SPAuthor
Participant
March 1, 2023

perfect, thank you very much. It works!