Javascript examples for DOM HTML Element:Input Datetime
The Input Datetime object represents an HTML <input> element with type="datetime".
You can access an <input> element with type="datetime" by using getElementById():
<!DOCTYPE html> <html> <body> <input type="datetime" id="myDatetime" value="2014-02-06T10:57Z"> <button onclick="myFunction()">get the date and time of the datetime field</button> <p id="demo"></p> <script> function myFunction() {/*w ww . j a va 2 s. co m*/ var x = document.getElementById("myDatetime").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>