HTML | DOM Input Datetime Object Last Updated : 31 Aug, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report The Input Datetime Object in HTML DOM is used to represent an HTML input element with type= "datetime". The input element with type= "datetime" can be accessed by using getElementById() method. Syntax: It is used to access input Datetime object.document.getElementById("id");It is used to create input element.document.createElement("input"); Input Datetime Object Properties: PropertyDescriptiontypeThis property is used to return which type of form element the Datetime field is.valueThis property is used to set or return the value of the value attribute of a Datetime field.autocompleteThis property is used to set or return the value of the autocomplete attribute of a Datetime field.autofocusThis property is used to set or return the Datetime field get focus automatically when the page loads.defaultValueThis property is used to set or return the default value of a Datetime field.disabledThis property is used to set or return whether a Datetime field is disabled or not.formThis property is used to return reference to the form that contains the Datetime field.listThis property is used to return a reference to the datalist that contains the Datetime field.maxThis property is used to set or return the value of the max attribute of a Datetime field.minThis property is used to set or return the value of the min attribute of a Datetime field.nameThis property is used to set or return the value of the name attribute of a Datetime field.placeholderThis property is used to set or return the value of the placeholder attribute of a Datetime field.readOnlyThis property is used to set or return whether the Datetime field is read-only or not.requiredThis property is used to set or return whether the Datetime field must be filled out before submitting a form.stepThis property is used to set or return the value of the step attribute of a Datetime field. Input Datetime Object Methods: MethodDescriptionselect()This method is used to select Datetime text field content.stepDown()This method is used to decrement the value of the input Datetime by a specified number.stepUp()This method is used to increment the value of the input Datetime by a specified number. Example-1: Return date time using "document.getElementById("id");". html <!DOCTYPE html> <html> <body> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <h2>DOM Input Datetime Object</h2> <input type="datetime" id="myDatetime" value="2018-02-07 10:15 AM "> <p>Click the button to get the date and time of the datetime field.</p> <button onclick="myFunction()"> Click Here! </button> <p id="demo"></p> <script> function myFunction() { // Get datetime value. var x = document.getElementById( "myDatetime").value; document.getElementById( "demo").innerHTML = x; } </script> </body> </html> Output: Before click on the button: After click on the button: Example-2: Create "datetime" element html <!DOCTYPE html> <html> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <h2>DOM Input Datetime Object</h2> <p> Click the button to create a Datetime field. </p> <button onclick="myFunction()"> Click Here! </button> <script> function myFunction() { // Create datetime element and // set attributes. var x = document.createElement("INPUT"); x.setAttribute("type", "datetime"); x.setAttribute("value", "2018-02-07 10:15 AM"); document.body.appendChild(x); } </script> </body> </html> Output: Before click on the button: After click on the button: Note: The <input type="datetime"> element does not show any datetime field/calendar in any major browsers, except Safari. Supported Browsers: Google Chrome 20Edge 12Firefox 93Opera 11Safari 14.1 Comment More infoAdvertise with us Next Article HTML | DOM Form submit() Method D divyatagoel0709 Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML DOM Form reset() Method The reset() method in the HTML DOM is used to reset a form fields to their default values. When a form is reset, all user input is cleared, and the fields revert to their initial states.SyntaxformObject.reset()Example: In this example, clicking the reset button clears the form inputs. html<!DOCTY 1 min read HTML | DOM Form submit() Method The form submit() Method in HTML DOM is used to send the form data to the web-server. It works as same as submit button. It does not contain any parameters. Syntax: formObject.submit()Example: index.html<!DOCTYPE html> <html> <head> <title> HTML DOM Form submit() Method </ 1 min read HTML | DOM Location Search Property The Location Search property in HTML DOM is used to set or return the query part of URL including question mark. The query part is the part of URL after the question mark. Syntax: It returns the location search property.location.searchIt is used to set the location search property.location.search = 1 min read HTML DOM Form action Property The HTML DOM Form action property allows accessing and modifying the action attribute of a form element through JavaScript. It determines the URL where form data is submitted when the form is submitted. Syntax: It is used to return the action property. formObject.actionIt is used to set the action p 3 min read HTML | DOM Form autocomplete Property The Form autocomplete property in HTML DOM is used to set or return of the autocomplete attribute. The autocomplete attribute is used to specify whether the autocomplete attribute has "on" or "off" value. When the autocomplete attribute is set to on so the browser will automatically complete the val 2 min read HTML | DOM Textarea rows Property The DOM Textarea rows Property is used to set or return the value of a rows attribute of a textarea field. The rows attribute specifies the number of visible text lines for the control i.e the number of rows to display. Syntax: It is used to Return the rows property:textareaObject.rowsIt is used to 2 min read HTML DOM Video Object The Video object in HTML DOM represents an <video> element. The video element can be accessed by using getElementById() method. Syntax: To access a video object: document.getElementById("videoId");where id is assigned to the <video> tag.To create a video object: document.createElement("V 4 min read HTML | DOM Input Month Object The Input Month Object in HTML DOM is used to represent an HTML input element with type= "month" attribute. The input element with type= "month" attribute can be accessed by using getElementById() method. Syntax: It is used to access <input> element with type="month" attribute.document.getElem 3 min read HTML | DOM Style flexGrow Property The HTML DOM style flexGrow property is used as a measure to determine how much an item will grow relative to the rest of the flexible items inside the same container. Syntax: Return flexGrow property:object.style.flexGrowSet flexGrow property:object.style.flexGrow = "number|initial|inherit" Propert 3 min read HTML | DOM Input Email Object The Input Email Object in HTML DOM is used to represent the HTML input element with type="email" attribute. The input element with type="email" attribute can be accessed by using getElementById() method. Syntax: It is used to access input email object.document.getElementById("id");It is used to crea 3 min read Like