Get the date and time of a datetime field:
var x = document.getElementById("myDatetime").value;
Click the button to get the date and time of the datetime field.
<!DOCTYPE html> <html> <body> Date: <input type="datetime" id="myDatetime" value="2014-02-06T10:57Z"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* www .j a v a 2 s. co m*/ var x = document.getElementById("myDatetime").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>