We can use getFullYear()
method on a Date instance
to get the year of the instance as a four-digit number.
The getMonth()
gives
the month as a number between 0 and 11.
Here, 0 represents January
and
11 represents December.
Similarly,
we can use
getDate()
,
getHours()
,
getMinutes()
,
getSeconds()
and
getMilliseconds()
to get the desired value.