HTML DOM Input Datetime value Property
HTML DOM Input Datetime value Property
-- Learning is not just about technology, but also about dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
JavaScript Reference
JavaScript Objects
- JavaScript Array Object
- JavaScript Boolean Object
- JavaScript Date Object
- JavaScript Math Object
- JavaScript Number Object
- JavaScript String Object
- JavaScript RegExp Object
- JavaScript Global Properties/Functions
- JavaScript Operators
- JavaScript Error
Browser Objects
DOM Objects
- HTML DOM Document Object
- HTML DOM Element Object
- HTML DOM Attribute Object
- HTML DOM Event Object
- HTML DOM Console Object
- CSSStyleDeclaration Object
- DOM HTMLCollection
HTML Objects
- <a>
- <area>
- <audio>
- <base>
- <blockquote>
- <body>
- <button>
- <canvas>
- <col>
- <colgroup>
- <datalist>
- <del>
- <details>
- <dialog>
- <embed>
- <fieldset>
- <form>
- <iframe>
- <frameset >
- <img>
- <ins>
- <input> - button
- <input> - checkbox
- <input> - color
- <input> - date
- <input> - datetime
- <input> - datetime-local
- <input> - email
- <input> - file
- <input> - hidden
- <input> - image
- <input> - month
- <input> - number
- <input> - range
- <input> - password
- <input> - radio
- <input> - reset
- <input> - search
- <input> - submit
- <input> - text
- <input> - time
- <input> - url
- <input> - week
- <keygen>
- <link>
- <label>
- <legend>
- <li>
- <map>
- <menu>
- <menuItem>
- <meta>
- <meter>
- <object>
- <ol>
- <optgroup>
- <option>
- <param>
- <progress>
- <q>
- <script>
- <select>
- <source>
- <style>
- <table>
- <td>
- <th>
- <tr>
- <textarea>
- <title>
- <time>
- <track>
- <video>
Deep Dive
- Programming
- Software
- Computer Science
- Scripting
- Development Tools
- Scripting Languages
- Web Service
- Web Design and Development
- Web Services
- Programming Languages
Input Datetime value Property
Example
Set the date and time of a datetime field:
document.getElementById("myDatetime").value = "2014-01-02T11:42Z";
Definition and Usage
The value property sets or returns the value of the value attribute of a datetime field.
The value property describes the date and time of a datetime field.
Browser Support
All major browsers support the value property.
Note: Internet Explorer, Firefox, Opera 15 (and later) or Chrome support the <input> element with type="datetime".
Syntax
Return the value property:
datetimeObject.value
Set the value property:
datetimeObject.value=YYYY-MM-DDThh:mm:ssTZD
Property Values
| Value | Description |
|---|---|
| YYYY-MM-DDThh:mm:ssTZD | Describes the date and time. Parsed as follows:
|
Technical Details
| Return Value: | A string representing the date and time of the datetime field. |
|---|
More Examples
Example
Get the date and time of a datetime field:
var x = document.getElementById("myDatetime").value;
x will output:
2014-02-06T10:57Z
Related Pages
HTML Reference: HTML <input> value Attribute
YouTip