'Creazione di oggetti data
'Gli oggetti data sono creati con il new Date()costruttore. 'Esistono 4 modi per creare un nuovo oggetto data: 'new Date() 'new Date(year, month, day, hours, minutes, seconds, milliseconds) 'new Date(milliseconds) 'new Date(date string) 'nuova data () 'new Date()crea un nuovo oggetto data con la data e l'ora correnti : 'Esempio 'var d = new Date(); <!DOCTYPE html> <html> <body> <h2>JavaScript new Date()</h2> <p>5 numbers specify year, month, day, hour, and minute:</p> <p id="demo"></p> <script> var d = new Date(2018, 11, 24, 10, 33); document.getElementById("demo").innerHTML = d; </script> </body> </html> ' oppure https://www.w3schools.com/js/tryit.asp?filename=tryjs_date_new_numbers5 <!DOCTYPE html> <html> <body> <h2>JavaScript new Date()</h2> <p>5 numbers specify year, month, day, hour, and minute:</p> <p id="demo"></p> <script> var d = new Date(); document.getElementById("demo").innerHTML = d; </script> </body> </html> |