HTML DOM Time dateTime property
Examples
Get <time> element represents the data:
var x = document.getElementById("myTime").dateTime;
x The output is:
2014-02-14
try it"
Definition and Usage
dateTime property sets or returns the <time> element values in datetime attribute.
datetime attribute specifies the date or time. When the date or time is not specified in the content of the element, the use of the property.
Note: datetime attribute in all browsers do not render any special effects.
Note: <time> element is new in HTML5.
Browser Support
Only Firefox and Opera 12 support dateTime attribute.
Note: Since version 15 onwards, Opera no longer support this property.
grammar
Back dateTime attributes:
timeObject .dateTime
Setting dateTime attributes:
timeObject .dateTime=YYYY-MM-DDThh:mm:ssTZD
Property Value
值 | 描述 |
---|---|
YYYY-MM-DDThh:mm:ssTZD | 日期或时间。下面解释了其中的成分:
|
technical details
return value: | A string representation of the computer's date and time elements can handle. |
---|
More examples
Examples
Change the <time> element Date and Time:
document.getElementById("myTime").dateTime="1999-06-24T09:30Z";
try it"
related articles
HTML Reference Manual: HTML <Time> datetime attribute