Estrarre tutte le informazioni dell’oggetto Date()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<script> var d=new Date() document.writeln("Date(): <b>" + d + "</b><br/>") document.writeln("Localizzata: <b>" + d.toLocaleString() + "</b><br/>") document.writeln("Localizzata: <b>" + d.toLocaleDateString() + "</b><br/>") document.writeln("Localizzata: <b>" + d.toLocaleTimeString() + "</b><br/>") document.writeln("Millesimi: <b>" + d.getTime() + "</b><br/>") document.writeln("Giorno: <b>" + d.getDate() + "</b><br/>") document.writeln("Mese: <b>" + d.getMonth() + "</b><br/>") document.writeln("Anno: <b>" + d.getFullYear() + "</b><br/>") document.writeln("Da 0 a 6: <b>" + d.getDay() + "</b><br/>") document.writeln("Ore: <b>" + d.getHours() + "</b><br/>") document.writeln("Minuti: <b>" + d.getMinutes() + "</b><br/>") document.writeln("Secondi: <b>" + d.getSeconds() + "</b><br/>") document.writeln("Millesimi: <b>" + d.getMilliseconds() + "</b>") </script> |
Le stesse informazioni con tecnica e rappresentazione diversa.