I need to check difference between two dates - from db and actual, but in minutes in JS/jQuery (I need to run function to check by ajax).
This is format of my date:
19-01-2016 22:18
I need something like this:
if ( (date_actual - date_db) < 1 minute ) {
//do something
}
How can I do this?
EDIT: I created something like this, but I always getting same log, it's not change - http://jsbin.com/xinaki/edit?js,console
EDIT 2: Here it's working code, BUT now it's checking in the same hour/minute, ex. 12:50:50 and 12:50:58 show log only for this 2 seconds, but I need to 'stay' log on 1 minute
http://jsbin.com/laruro/edit?js,console