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

Javascript examples for DOM HTML Element:Input Datetime Local

Description

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="datetime-local" id="myLocalDate" value="2018-11-16T15:25:33">

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

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

<script>
function myFunction() {/*from  ww w.  ja  va2  s.c  o  m*/
    var x = document.getElementById("myLocalDate").value;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

Related Tutorials