HTML | DOM Input DatetimeLocal Object Last Updated : 15 Sep, 2022 Comments Improve Suggest changes Like Article Like Report The Input DatetimeLocal object is used for representing an HTML <input> element of the type="datetime-local". The Input DatetimeLocal Object is a new object in HTML5. Syntax: For creating a <input> element with the type ="datetime-local":gfg = document.createElement("input") gfg.setAttribute("type", "datetime-local");For accessing a <input> element with the type ="datetime-local":document.getElementById("datetimeLocal_object") Property Values: ValueDescriptionautocompleteIt is used for setting or returning the value of the autocomplete attribute of a datetime field.autofocusIt is used for setting or returning whether a datetime field should automatically get focus when the page loads.defaultValueIt is used for setting or returning the default value of a datetime field.disabledIt is used for setting or returning whether a datetime field is disabled, or not.formIt is used for returning a reference to the form that contains the datetime field.listIt is used for returning a reference to the datalist that contains the datetime field.maxIt is used for setting or returning the value of the max attribute of the datetime field.minSets or returns the value of the min attribute of the datetime field.nameIt is used for setting or returning the value of the name attribute of a datetime field.readOnlyIt is used for setting or returning whether the datetime field is read-only, or not.requiredIt is used for setting or returning whether the datetime field must be filled out before submitting a form.stepIt is used for setting or returning the value of the step attribute of the datetime field.typeIt is used for returning which type of form element the datetime field is.valueIt is used for setting or returning the value of the value attribute of a datetime field. Input DatetimeLocal Object Methods: stepDown() : It is used for decrementing the value of the datetime field by a specified number.stepUp() : It is used for incrementing the value of the datetime field by a specified number.select() : It is used to select the contents of the DateTimeLocal field. Below programs illustrate the Datetime Object: Example-1: Creating a <input> element with the type ="datetime-local" . HTML <!DOCTYPE html> <html> <head> <title>Input DatetimeLocal Object</title> <style> h1 { color: green; } h2 { font-family: Impact; } body { text-align: center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>Input DatetimeLocal Object</h2> <p>Double Click the "Create" button to create a DatetimeLocal field.</p> <button ondblclick="Create()"> Create </button> <script> function Create() { // Create input element type "datetime-local" var c = document.createElement("INPUT"); c.setAttribute("type", "datetime-local"); c.setAttribute("value", "2019-07-02T25:32Z"); document.body.appendChild(c); } </script> </body> </html> Output: Before clicking the button: After clicking the button: Example-2: Accessing a <input> element with the type ="datetime-local". HTML <!DOCTYPE html> <html> <head> <title>HTML | DOM Input DatetimeLocal Object</title> <style> h1 { color: green; } h2 { font-family: Impact; } body { text-align: center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>Input Datetime Object</h2> <input type="datetime" id="test" value="2019-07-02T25:32Z"> <p>Double Click the "Access" button to access a Datetime field.</p> <button ondblclick="Access()">Access</button> <p id="check"></p> <script> function Access() { // Accessing input element type value var a = document.getElementById( "test").value; document.getElementById( "check").innerHTML = a; } </script> </body> </html> Output: Before clicking the button: After clicking the button: Supported Browsers: Google Chrome 20Edge 12Firefox 93Opera 11Safari 14.1 Comment More infoAdvertise with us Next Article HTML | DOM Input DatetimeLocal Object S Shubrodeep Banerjee Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML | DOM Form target Property The DOM Form Target property is used to set or return the value of the target attribute of the form.The Target attribute is used to specify whether the submitted result will open in the current window, a new tab or on a new frame. Syntax: It is used to return the target property. formObject.target I 3 min read HTML | DOM KeyboardEvent shiftKey Property The KeyboardEvent shiftKey property in HTML DOM is a read-only property and used to return a Boolean value which indicates the SHIFT key is pressed or not. The KeyboardEvent shiftKey property returns true if the SHIFT key is pressed, otherwise returns false. Syntax: event.shiftKey Below program illu 1 min read HTML | DOM Form length Property The DOM Form length Property is used to return the number of input field contained in the form. Syntax: formObject.length Return Value: It returns a numeric value which represent the number of input field or elements in the Form. Example-1: Return the number of input field. html <!DOCTYPE html 2 min read HTML | DOM Form acceptCharset Property The DOM Form acceptCharset Property is used to set or return the value of the accept-charset attribute in the form Element. The accept-charset attribute is used to define the character encoding and is used for form submission. The default value of the accept-charset attribute is âUNKNOWNâ string whi 2 min read HTML | DOM KeyboardEvent metaKey Property The KeyboardEvent metaKey property in HTML DOM is a read-only property and is used to return a Boolean value which is used to check whether the META key is pressed or not. The KeyboardEvent metaKey property returns true if the META key is pressed, otherwise returns false. Syntax: event.metaKey Below 1 min read HTML DOM Select Object The Select object in HTML DOM is used to represent an HTML <select> element. It provides properties and methods to manipulate the <select> element and its associated <option> elements.Syntax:To create <select> element. document.createElement("SELECT")To access <select> 3 min read HTML | DOM TouchEvent touches Property The TouchEvent touches property in HTML DOM is used to return the array of touch object. It returns one for each finger that is currently touching to the surface. The touches property is a read only property and it returns an array of touch objects. Syntax: event.touches Return Value: It return the 1 min read HTML | DOM form method Property The DOM Form method Property is used to set or returnthe value of the method attribute in the form. The method attribute is used to specify the HTTP method used to send data while submitting the form. There are two kinds of HTTP Methods, which are GET and POST. Syntax: It is used to return the metho 3 min read HTML | DOM Form name Property The DOM Form name Property is used to set or return the value of the name attribute in a form. The name attribute is required for each input field. If the name attribute is not specified in an input field then the data of that field would not be sent at all. Syntax: It is used to return the name pro 2 min read HTML | DOM Style alignSelf Property The DOM Style alignSelf property is used to set or return the alignment for a selected item inside a flexible container. Syntax: To get the alignSelf Propertyobject.style.alignSelfTo set the alignSelf Propertyobject.style.alignSelf = "auto | stretch | center | flex-start | flex-end | baseline | init 6 min read Like