The getDate method returns the day of the month of the point in time stored in a Date object. The value returned by this method is an integer number from 1 to 31.
Syntax
myDate.getDate()
With myDate being an object based on the Date object.
Instead of being instantiated from a class, in JavaScript objects are created by replicating other objects. This paradigm is called Prototype-based programming.
Example
The following code returns the day of the month for the current date:
<script type="text/javascript">
var myDate = new Date();
var dayOfTheMonth = myDate.getDate();
document.write("The current day of the month is: " + dayOfTheMonth + ".");
</script>
var myDate = new Date();
var dayOfTheMonth = myDate.getDate();
document.write("The current day of the month is: " + dayOfTheMonth + ".");
</script>
Technical Details
The getDate method belongs to the Date object, it is available since the version 1.1 of JavaScript, and it is supported in all major browsers.
JavaScript Manual >> Date Object >> getDate Method