How to get the current day, month, and year in JavaScript

In this short article, we’ll show you how to get the current day, month, and year in JavaScript. Here, we will use the pure vanilla JavaScript code to get the day, month year from the Date object in JavaScript.

Get the current Date object

Use the following code to get the current date object.

Get current year

getFullYear() – Provides current year like 2019.

Get current month

getMonth() – Provides current month values 0-11. Where 0 for Jan and 11 for Dec.

Get current day

getDate() – Provides day of the month values 1-31.

Get current hour

getHours() – Provides current hour between 0-23.

Get current minutes

getMinutes() – Provides current minutes between 0-59.

Get current seconds

getSeconds() – Provides current seconds between 0-59.

Get current time

Let’s combine current hours, minutes and seconds to get the current time.

That’s it for today.
Thank you for reading. Happy Coding..!! 🙂

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *