date of birth javascript w3 code example
Example 1: javascript date
var currentDate = new Date();
var dateFromTimeStamp= new Date(1560807962);
var dateFromString = new Date('December 17, 1995 03:24:00');
//new Date(year, month, day, hours, minutes, seconds, milliseconds)
//0= Jan, 11=Dec
var dateFromYearMonthDay = new Date(2018, 11, 26, 0, 0, 0, 0);
Example 2: display date in javascript
<button onclick="displayDate()">The time is?</button>
<script>
function displayDate() {
document.getElementById("demo").innerHTML = Date();
}
</script>