C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Date getDate() methodThe JavaScript date getDate() method returns the day for the specified date on the basis of local time. Syntax
The getDate() method is represented by the following syntax: dateObj.getDate() Return
An integer value between 1 and 31 that represents the day of the specified date. JavaScript Date getDate() method example
Here, we will understand getDate() method through various examples. Example 1Let's see an example to print today's date.
<script>
var date=new Date();
document.writeln("Today's day: "+date.getDate());
</script>
Output: Today's day: 16 Example 2Let's see an example to print the day from the given date.
<script>
var date=new Date("August 15, 1947 20:22:10");
document.writeln(date.getDate())
</script>
Output: 15
Next TopicJavaScript Math
|