Loading....

Creating Date Objects

Date objects are created with the new Date() constructor.
There are 9 ways to create a new date object:
In JavaScript, January is month number 0, February is number 1, …
Finally, December is month number 11.

Method Syntax Output
new Date() new Date()
new Date(year,month) new Date(2024, 4)
new Date(year,month,day) new Date(2024, 4, 12)
new Date(year,month,day,hour) new Date(2024, 4, 12, 00)
new Date(year,month,day,hour,minutes) new Date(2024, 4, 12, 10, 30)
new Date(year,month,day,hour,minutes,seconds) new Date(2024, 4, 12, 10, 30, 00)

JavaScript Get Date Methods

Method Syntax Output Description
getFullYear() new Date().getFullYear() Get year as a four digit number (yyyy)
getMonth() new Date().getMonth() Get month as a number (0-11)
getDate() new Date().getDate() Get day as a number (1-31)
getDay() new Date().getDay() Get weekday as a number (0-6)
getHours() new Date().getHours() Get hour (0-23)
getMinutes() new Date().getMinutes() Get minute (0-59)
getSeconds() new Date().getSeconds() Get second (0-59)
getMilliseconds() new Date().getMilliseconds() Get millisecond (0-999)
getTime() new Date().getTime() Get time (milliseconds since January 1, 1970)

Last Update: July 10, 2026  

July 9, 2026 6 vikas@crmhike.com  JS
Total 0 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Add A Knowledge Base Question !

You will receive an email when your question will be answered.

+ = Verify Human or Spambot ?

Back To Top

Add A Knowledge Base Question !

You will receive an email when your question will be answered.

+ = Verify Human or Spambot ?