- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 to get current date and time in JavaScript?
To get current date and time in JavaScript, use the Date object.
Example
You can try to run the following code to display date and time −
<!DOCTYPE html> <html> <body> <p id="currentDate"></p> <script> document.getElementById("currentDate").innerHTML = Date(); </script> </body> </html>
Advertisements