Javascript examples for DOM HTML Element:Input Datetime Local
The max property sets or gets the max attribute of a local datetime field, which controls the maximum date and time for a local datetime field.
Set the max property with the following Values
Value | Description |
---|---|
YYYY-MM-DDThh:mm:ss.ms | Sets the maximum date and time allowed for the local 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 local datetime field:
<!DOCTYPE html> <html> <body> Date and time:// w w w .j a va2 s.c om <input type="datetime-local" id="myLocalDate" min="2000-10-06T22:22:55" max="2018-11-16T21:25:33"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myLocalDate").max; document.getElementById("demo").innerHTML = x; } </script> </body> </html>