How to get current Date and Time using JavaScript

107
javascript get current date and time

In this article, we will learn about javascript get current date and time formatted. Use the following JavaScript code to get current date and time with Y-m-d and H:i:s format.

JavaScript Date object helps us to work with dates. Use new Date() to create a new object with the current date and time.

Get current date from Date object in Y-m-d format.

Get current time from Date object in H:i:s format.

Get current date and time from Date object in Y-m-d H:i:s format.

For more details refer to JavaScript Get Date Methods

Conclusion

I hope you liked this article about how to get current Date in JavaScript. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.

LEAVE A REPLY

Please enter your comment!
Please enter your name here