Skip to content

Instantly share code, notes, and snippets.

@radislaw
Created March 30, 2018 04:32
Show Gist options
  • Select an option

  • Save radislaw/13ed0b6a80026c80858f9384b3a60ae4 to your computer and use it in GitHub Desktop.

Select an option

Save radislaw/13ed0b6a80026c80858f9384b3a60ae4 to your computer and use it in GitHub Desktop.
log to console page loaded time
function getCurrentTime() {
const date = new Date();
let h = date.getHours();
let m = date.getMinutes();
let s = date.getSeconds();
h = h < 10 ? `0${h}` : h;
m = m < 10 ? `0${m}` : m;
s = s < 10 ? `0${s}` : s;
return `${h}:${m}:${s}`;
}
console.log(`%c Страница обновлена в %c ${getCurrentTime()} %c`,
"background:#F39C12; padding: 5px; border-radius: 3px 0 0 3px; color: #fff; font-size: 16px",
"background:#E74C3C; padding: 5px; border-radius: 0 3px 3px 0; color: #fff; font-weight: bold; font-size: 16px",
"background:transparent");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment