I need to calculate a difference between two time using javascript: now is the moment when you load the page so I use:
now = new(Date).getMinutes()*60;
then is the first minute of the next hour. So for example now is 20:20 where I live: then will be 21:01. then my logic will be:
if(then-now>=120){
diff=120;
}else{
diff=then-now;
}
When I calculate the difference I need to include all the first minute of next hour. What can be the smartest way to calculate then in seconds?