Get the minimum date and time allowed for a local datetime field:
var x = document.getElementById("myLocalDate").min;
Click the button to display the value of the min attribute of the local datetime field.
<!DOCTYPE html> <html> <body> Enter a date and time between 2000-10-06 22:22:55 and 2014-11-16 21:25:33: <input type="datetime-local" id="myLocalDate" min="2000-10-06T22:22:55" max="2014-11-16T21:25:33"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* w ww. j av a 2s . c o m*/ var x = document.getElementById("myLocalDate").min; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The min
property sets or gets the value of the min attribute of a local datetime field.
The min attribute specifies the minimum value of date and time for a local datetime field.
Date format:
Value | Description |
---|---|
YYYY-MM-DDThh:mm:ss.ms | Specifies the minimum date and time allowed for the local datetime field. |
Components of value:
The min
property returns a String representing the minimum date and time allowed.