miércoles, 23 de agosto de 2023
Mostrar la fecha y hora actual en la página web.
function currentTime() {
// Get the current date and time
const now = new Date();
// Format the date and time
let time = now.toLocaleString("en-US", {
timeStyle: "short",
// The date format will vary depending on the locale
// For example, in the US, the date format is "MM/DD/YYYY"
dateStyle: "short"
});
// Display the time and date
document.getElementById("clock").innerText = time;
}
// Set the interval to update the time and date every second
setInterval(currentTime, 1000);
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario