<script>
function startDate() {
var d = new Date();
var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
document.getElementById("date").innerHTML = days[d.getDay()]+" | "+d.getDate()+" "+months[d.getMonth()]+" "+d.getFullYear();
}
startDate();
</script>
<body onload='startDate()'>
<div id='date'></div> <!-- use some css on #Date -->
</body>
The <input type="date"> defines a date picker.
The resulting value includes the year, month, and day.
Tip: Always add the <label> tag for best accessibility practices!
<label for="birthday">Birthday:</label>
<input type="date" id="birthday" name="birthday">