Get Current Index from the List

Hello everyone
I am Trying to Get Index from the list

Example:

Current Time: 07:50

My List
07:50
08:10
08:25
08:50
09:00

I want to get index of upcoming time which is 8:10 (Index 2)

But I am getting Index 0

Here what I Tried

You are Comparing Minutes Seperately

So You Are Comparing 8:10 & 7:50

So it Will show 7:50 is greater
Option 1 :
Instead Deformat your Time in list and Compare Without time Formatting. In This Way you can Compare Time

Option 2:
Format The Time to HHmm (Without any Seperator) so Definitely 0810 will be greater than 0750

Edit: One more suggestion
When You Time.now in calculating, there is a chance the minutes change during the calculation making it wrong. So in the starting save your Time In a Variable and Use that

Thank you for your replay
can you explain in Blocks :sweat_smile:

Also you can use the current time is greater or less than logic

@Still-learning
I Tried this method but gave error

Loop is very important. You need to check between the times you index have to pick hardly

Else you can use js function but need s extension or web viewer. It can be achieved by defult blocks

Or simply test with clock timer…

@Rohith_kumar Note Label Text time format is HH":"mm
But global Current Time format is HHmm

1 Like

@DhaneshBaheti
I also tried your second option you gave to me :sweat_smile:

It works

1 Like

Have you test with different time???

Since it is in index 2 it breaks else…??

@Still-learning its works

1 Like

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