NOTE:NOTA:Downloads reserved for members can also be made without registration with a free donation in support of the site.I download riservati ai membri possono essere effettuati anche senza registrazione con una donazione libera in sostegno del sito.
Si aggiorna all'aggiornamento della pagina.
Esempio:
Codice:
<p id="demo"></p>
<script>
const d = new Date();
let text = d.toLocaleString();
document.getElementById("demo").innerHTML = text;
</script>
Real time date and time - HTML, JS
Data e ora in tempo reale - HTML, JS
Esempio:
Codice:
<div id="date-time"></div>
<script>
// Function to format 1 in 01
const zeroFill = n => {
return ('0' + n).slice(-2);
}
// Creates interval
const interval = setInterval(() => {
// Get current time
const now = new Date();
// Format date as in mm/dd/aaaa hh:ii:ss
const dateTime = zeroFill((now.getMonth() + 1)) + '/' + zeroFill(now.getUTCDate()) + '/' + now.getFullYear() + ' ' + zeroFill(now.getHours()) + ':' + zeroFill(now.getMinutes()) + ':' + zeroFill(now.getSeconds());
// Display the date and time on the screen using div#date-time
document.getElementById('date-time').innerHTML = dateTime;
}, 1000);
</script>
Last page update date - HTML, JS
Data dell'ultimo aggiornamento della pagina - HTML, JS
Data dell'ultimo aggiornamento della pagina con data stile italiano - HTML, JS
Codice:
<p>Ultimo aggiornamento il <span id="modify"></span></p>
<script>
var data_mod = new Date(document.lastModified);
var giorno = data_mod.getDate();
var mese = data_mod.getMonth() + 1;
var anno = data_mod.getFullYear();
var ora = data_mod.getHours();
var minuti = data_mod.getMinutes();
document.getElementById("modify").innerHTML = giorno + "/" + mese + "/" + anno + " " + ora + ":" + minuti;
</script>