Date setDate Setta o aggiunge giorni





' Il setDate()metodo imposta il giorno di un oggetto data (1-31):


https://www.w3schools.com/js/tryit.asp?filename=tryjs_date_setdate

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript setDate()</h2>

<p>The setDate() method sets the day of a date object:</p>

<p id="demo"></p>

<script>
var d = new Date();
d.setDate(15);
document.getElementById("demo").innerHTML = d;
</script>

</body>
</html>

' Il setDate()metodo puo' anche essere utilizzato per aggiungere giorni a una data:

https://www.w3schools.com/js/tryit.asp?filename=tryjs_date_ahead


<!DOCTYPE html>
<html>
<body>

<h2>JavaScript setDate()</h2>

<p>The setDate() method can be used to add days to a date.</p>

<p id="demo"></p>

<script>
var d = new Date();
d.setDate(d.getDate() + 50);
document.getElementById("demo").innerHTML = d;
</script>

</body>
</html>












( datesetdatesettaoaggiungegiorni.html )- by Paolo Puglisi - Modifica del 17/12/2023