
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Time Object
The HTML DOM Time Object in HTML represents the <time> element.
Creating a <time> element
var timeObject = document.createElement(“TIME”)
Here, “timeObject” can have the following properties −
Property |
Description |
---|---|
dateTime |
Itsets/returns the value of the dateTime attribute of a <time>element |
Let us see an example of Time dateTime property −
Example
<!DOCTYPE html> <html> <head> <title>Time dateTime</title> <style> form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } </style> </head> <body> <form> <fieldset> <legend>Time-dateTime</legend> <label>Notification : <strong>Examination Incoming!</strong> <time id="TimeDateTimeSelect" dateTime="2019-05-23T12:45Z"> </label> <input type="button" onclick="getExamDate()" value="What's the Exam Date?"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var TimeDateTimeSelect = document.getElementById("TimeDateTimeSelect"); function getExamDate() { divDisplay.textContent = 'Examination Date: '+TimeDateTimeSelect.dateTime; } </script> </body> </html>
Output
Before clicking ‘What’s the Exam Date?’ button −
After clicking ‘What’s the Exam Date?’ button −
Advertisements