Skip to content

Instantly share code, notes, and snippets.

@0mj
Created April 30, 2025 12:38
Show Gist options
  • Select an option

  • Save 0mj/8f1c1ce6f005cffd68be67778bffae6e to your computer and use it in GitHub Desktop.

Select an option

Save 0mj/8f1c1ce6f005cffd68be67778bffae6e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Current Time</title>
<script>
function updateTitleTime() {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
document.title = `${hours}:${minutes}:${seconds}`;
}
setInterval(updateTitleTime, 1000);
updateTitleTime(); // Initial display
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment