Hi I'm new in javascript I have such javascript code
alert(DATE.value); var d = new Date(DATE.value); var year = d.getFullYear(); var month = d.getMonth(); var day = d.getDay(); alert(month); alert(day); if(2012 < year < 1971 | 1 > month+1 > 12 | 0 >day > 31){     alert(errorDate);     DATE.focus();     return false; }   take for instance: DATE.value = "11/11/1991"
when I call alert(day); it shows me 3;
 when I call alert(d); it is returns me correct info.
use .getDate instead of .getDay.
The value returned by getDay is an integer corresponding to the day of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With