DolyGamesCosmos thank you for your response but I think your answer is not what I'm looking for.
I already understand what you're saying but I'm looking for how to reset certain global variable when the current time (current time here means the real-time or your device real-time where you live at and of course it's gonna be different for each person if they live in different time zone in the world) changed.
I've set it this way in the capx.
'on start of layout' event, i've set to check if the 'Current_Date' variable is not equal to Browser.ExecJS("Date()"), then in the action, it will set 'Reward_Earned' variable to 0 (zero).
in the event 'see_video' button is clicked, it will check again if the 'Reward_Earned' variable is less than 5, then the action will count it and if it reach 5/5 or max, the 'see_video' button will become unclickable.
this is why I need to set if the day has change, the 'Reward_Earned' variable will set to 0 (zero).
The bold point above is what I want to be happened by doing the red point above but the red point above is where something went wrong.
this point is what I don't know at all.
does something wrong in my code or i'm not doing it the right way?
Any suggestions?