Show Output
<!DOCTYPE html> <html lang="en"> <head> <title>HTML5 Datetime-local Input Type</title> <script> function getValue() { var datetime = document.getElementById("mydatetime").value; alert(datetime); } </script> </head> <body> <form> <label for="mydatetime">Choose Date and Time:</label> <input type="datetime-local" id="mydatetime"> <button type="button" onclick="getValue();">Get Value</button> </form> </body> </html>