Javascript examples for DOM HTML Element:Time
The dateTime property sets or gets the datetime attribute in a <time> element.
Set the dateTime property with the following Values
Value | Description |
---|---|
YYYY-MM-DDThh:mm:ssTZD | The date or time being specified. |
A String, representing a machine-readable form of the element's date and time
The following code shows how to get the date that a <time> element represents:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w w w . j a va 2 s.c o m var v = document.getElementById("myTime").dateTime; document.getElementById("demo").innerHTML = v; } </script> </body> </html>