Input Datetime value Property - Get the date and time of a datetime field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Datetime

Description

Input Datetime value Property - Get the date and time of a datetime field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Date: <input type="datetime" id="myDatetime" value="2018-02-06T10:57Z">

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from  www  . j  av a2  s . com
    var x = document.getElementById("myDatetime").value;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

Related Tutorials