The code below shows the day, month and year as:
6
3
116
Which is obviously wrong dates.
var date= new Date();
var day=date.get
getDay()
returns the day of the week from 0-6 for Sun-Sat,
getMonth()
returns the month from 0-11, so 3 means April,
getYear()
has been deprecated and replaced with getFullYear()
which should be used instead.
It just looks like all of these functions do something different than what you were expecting.
To get day of the month from 1-31: getDate()
,
To get month like you were expecting, just add 1: getMonth() + 1