Documentation on Formatting a Date in JavaScript



The Date object is a datatype built into the JavaScript language. Date objects are created with the new Date( ) as shown below −

new Date( )
new Date(milliseconds)
new Date(datestring)
new Date(year,month,date[,hour,minute,second,millisecond ])

The following method is used to Manipulate Dates in JavaScript −

Sr.No
Method & Description
1 Date()
Returns today's date and time
2 getDate()
Returns the day of the month for the specified date according to local time.
3 getDay()
Returns the day of the week for the specified date according to local time.
4 getFullYear()
Returns the year of the specified date according to local time.
5 getHours()
Returns the hour in the specified date according to local time.
6 getMilliseconds()
Returns the milliseconds in the specified date according to local time.
7 getMinutes()
Returns the minutes in the specified date according to local time.

For complete documentation and examples, refer to the following resource.

Updated on: 2020-06-23T06:50:58+05:30

83 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements