

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do I get the current date in JavaScript?
To get the current date in JavaScript, use the getDate() method.
Example
You can try to run the following code get the date:
<!DOCTYPE html> <html> <body> <p>Today's Date</p> <button onclick="myFunction()">Get Date</button> <p id="test"></p> <script> function myFunction() { var date = new Date(); var n = date.getDate(); document.getElementById("test").innerHTML = n; } </script> </body> </html>
- Related Questions & Answers
- How do I get the current date and time in JavaScript?
- How can I get the current time and date in Kotlin?
- How do I get the current time zone of MySQL?
- Get current date/time in seconds - JavaScript?
- How do I display the current date and time in an Android application?
- How do I display the current date and time in an iOS application?
- How to get current date and time in JavaScript?
- How do I calculate the date six months from the current date using the datetime Python module?
- How to get the current date in Java?
- How to get current date and time using JavaScript?
- How to get current date/time in seconds in JavaScript?
- How do I get the creation date of a MySQL table?
- How do I get current URL in Selenium Webdriver 2 Python?
- How do I get the current AUTO_INCREMENT value for a table in MySQL?
- How do I subtract minutes from a date in JavaScript?
Advertisements