Now you can listen to this article with the Online Text Reader


JavaScript getDate Method





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.


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>


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





© Copyright 2010-2018 ROM Cartridge



Books to Read and Listen to Online