Код: Выделить всё
let currentDateTime = new Date();
hours = ('0'+currentDateTime.getHours()).slice(-2);
mins = ('0'+currentDateTime.getMinutes()).slice(-2);
let formattedTime = hours + ":" + mins;
$('#time').html(formattedTime);
Код: Выделить всё
let currentDateTime = new Date();
hours = ('0'+currentDateTime.getHours()).slice(-2);
mins = ('0'+currentDateTime.getMinutes()).slice(-2);
let formattedTime = hours + ":" + mins;
$('#time').html(formattedTime).setInterval(1000);
Подробнее здесь: https://stackoverflow.com/questions/647 ... ery-second
Мобильная версия