Javascript examples for DOM HTML Element:Input Datetime Local
The min property sets or gets the min attribute of a local datetime field, which controls the minimum date and time for a local datetime field.
You can use the min and max attributes to create a range of legal values.
Set the min property with the following Values
Value | Description |
---|---|
YYYY-MM-DDThh:mm:ss.ms | Sets the minimum date and time allowed for the local datetime field. |
A String, representing the minimum date and time allowed
The following code shows how to get the minimum date and time allowed for a local datetime field:
<!DOCTYPE html> <html> <body> Date and time://from w w w . j a va2s .co m <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").min; document.getElementById("demo").innerHTML = x; } </script> </body> </html>