Skip to content

Instantly share code, notes, and snippets.

@savayer
Last active July 13, 2018 06:42
Show Gist options
  • Save savayer/7cf93418905485c4f33572ebf77098a6 to your computer and use it in GitHub Desktop.
Save savayer/7cf93418905485c4f33572ebf77098a6 to your computer and use it in GitHub Desktop.
var remain_bv = 1200; //секунд
function timeLeft(timestamp){
if (timestamp < 0) timestamp = 0;
var day = Math.floor( (timestamp/60/60) / 24);
var hour = Math.floor(timestamp/60/60);
var mins = Math.floor((timestamp - hour*60*60)/60);
var secs = Math.floor(timestamp - hour*60*60 - mins*60);
var left_hour = Math.floor( (timestamp - day*24*60*60) / 60 / 60 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment