Javascript examples for DOM HTML Element:Input Datetime
The min property sets or gets the min attribute of a datetime field, which controls the minimum date and time for a datetime field.
Set the min property with the following Values
Value | Description |
---|---|
YYYY-MM-DDThh:mm:ssTZD | Sets the minimum date and/or time allowed for the 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 datetime field:
<!DOCTYPE html> <html> <body> Date and time://from www. j a v a 2 s. c o m <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").min; document.getElementById("demo").innerHTML = x; } </script> </body> </html>