Javascript examples for DOM HTML Element:Input Datetime
The max property sets or gets the max attribute of a datetime field, which controls the maximum date and time for a datetime field.
Set the max property with the following Values
Value | Description |
---|---|
YYYY-MM-DDThh:mm:ssTZD | Sets the maximum date and/or time allowed for the datetime field. |
A String, representing the maximum date and time allowed
The following code shows how to get the maximum date and time allowed for a datetime field:
<!DOCTYPE html> <html> <body> Date and time:/*from www . ja v a 2 s . com*/ <input type="datetime" id="myDatetime" min="2000-01-01T22:57Z" max="2018-02-06T22:57Z"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myDatetime").max; document.getElementById("demo").innerHTML = v; } </script> </body> </html>