JavaScript Show Date
In this section, we are going to display the current date using JavaScript.
You can see in the given example, we have created Date object which holds the current date and time. Now, in order to display the date, we have used getDate(), getMonth() and getFullYear() methods with the date object. We have added 1 to the month variable to display the month correctly because getMonth() method returns 0 for the month of January and 11 for December. When you load the following code, you will get the current date.
Here is the code:
| <html> <h2>Show Date</h2> <script type="text/javascript"> var date = new Date(); var day = date.getDate(); var month = date.getMonth() + 1; var year = date.getFullYear(); document.write("<b>Today's Date is :</b> "+day + "/" + month + "/" + year); </script> </html> |
Output will be displayed as:
Tutorials
- Java 26 (JDK 26) Features with examples
- Top 10 Reasons to Learn Java in 2026
- JDK 26 Tutorial
- Java Certification Roadmap 2026: Which Oracle Certs Matter
- Install JDK 26: A Complete Beginner's Guide (2026)
- What Is Java? A Complete, Up-to-Date Guide for 2026
- Java 26 HTTP3 tutorial - HTTP 3 support in JDK 26 - How to use HTTP/3 in Java 26 application?
- JDK 28 Preview: Value Objects, Shenandoah GC & JSON API
- Java Tutorials


