Datetime
Datetime
2) getMonth()
3) getDate()
The getDate() method returns the day of a date as a number (1-31):
4) getHours()
The getHours() method returns the hours of a date as a number (0-
23):
5) setDate()
6) setHours()
The setHours() method sets the hours of a date object (0-23):
7) setMinuites()
The setMinutes() method sets the minutes of a date object (0-59):
<!DOCTYPE html>
<html>
<body>
The getDate() method returns the day of a date as a number (1-31)
<p id="demo"></p>
<p id="demo1"></p>
<script>
const d = new Date();
d.getHours();
document.getElementById("demo").innerHTML = d.getDate();
document.getElementById("demo1").innerHTML = d.getHours();
</script>
</body>
</html>
Output :- The getDate() method returns the day of a date as a number (1-31):
22
Set the day of the month to the last day of the previous month: