Input the year:
Input the month (zero based with 0 for January):
Input the day of the month:
// sample-3-date.js // This sample shows some date formats // display the input date in several formats function display() { var input1 = document.getElementById("input1"); var input2 = document.getElementById("input2"); var input3 = document.getElementById("input3"); var output1 = document.getElementById("output1"); var output2 = document.getElementById("output2"); // convert value strings to numbers var input_value1 = new Number(input1.value); var input_value2 = new Number(input2.value); var input_value3 = new Number(input3.value); // three numeric arguments passed to the Date constructor var date1 = new Date(input_value1,input_value2,input_value3); output1.value = date1.getTime(); output2.value = date1.toLocaleString(); }