The HTMLTimeElement
.dateTime
property is a DOMString
that reflects the datetime
HTML attribute, containing a machine-readable form of the element's date and time value.
The format of the string must follow one of the following HTML microsyntaxes:
Microsyntax | Description | Examples |
---|---|---|
Valid month string |
YYYY- MM
|
2011-11 , 2013-05
|
Valid date string |
YYYY- MM- DD
| 1887-12-01 |
Valid yearless date string |
MM- DD
| 11-12 |
Valid time string |
HH: MMHH : MM: SSHH : MM: SS. mmm
|
23:59 12:15:47 12:15:52.998
|
Valid local date and time string |
YYYY- MM- DD HH: MMYYYY - MM- DD HH: MM: SSYYYY - MM- DD HH: MM: SS. mmmYYYY - MM- DDT HH: MMYYYY - MM- DDT HH: MM: SSYYYY - MM- DDT HH: MM: SS. mmm
| 2013-12-25 11:12 |
Valid time-zone offset string |
Z + HHMM+ HH: MM- HHMM- HH: MM
| Z |
Valid global date and time string | Any combination of a valid local date and time string followed by a valid time-zone offset string | 2013-12-25 11:12+0200 |
Valid week string |
YYYY-W WW
| 2013-W46 |
Four or more ASCII digits | YYYY |
2013 , 0001
|
Valid duration string |
P dD T hH mM sS P dD T hH mM s. XS P dD T hH mM s. XXS P dD T hH mM s. XXXS P T hH mM sS P T hH mM s. XS P T hH mM s. XXS P T hH mM s. XXXS w w dd hh mm ss
| P12DT7H12M13S |
dateTimeString = timeElt.dateTime; timeElt.dateTime = dateTimeString
// Assumes there is <time id="t"> element in the HTML var t = document.getElementById("t"); t.dateTime = "6w 5h 34m 5s";
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'HTMLTimeElement' in that specification. | Living Standard | No change from HTML 5.1. |
HTML 5.1 The definition of 'HTMLTimeElement' in that specification. | Recommendation | No change from HTML5. |
HTML5 The definition of 'HTMLTimeElement' in that specification. | Recommendation | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 62 | Yes | 22 | No | 49
|
No |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 62 | 62 | Yes | 22 | 49
|
No | ? |
HTMLTimeElement
interface it belongs to.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLTimeElement/dateTime