Readme

⌚ get a user's current local time

1
2
3
4
5
6
7
8
9
10
export function currentTime(element) {
function update() {
const now = new Date();
const timeString = now.toLocaleTimeString();
element.textContent = timeString;
}
update();
setInterval(update, 1000);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
June 6, 2024