Hy guys.
How can I compare this data…
var str = '09:29';
var parts = str.split(':');
minutes = parts[1];
hour = parts[2];
with actual hour?
I have a table with that value and want to compare if it is 5 minutes older than the actual time.
Thks folks.
This code will be useful to get the actual time:
Now you can either compare the hours and see if they are the same (or within 1 of each other to account for a difference in minutes), or you can do it mathematically, which is how I would do it.
This is how I would go about doing that. I’d seperate the arithmetic logic out of the if statement though.
Edit: Here is the code I would probably use.