- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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
The datetime attribute of the <time> element is used to display the machine-readable date time.
Following is the syntax −
<time datetime="YYYY-MM-DDThh:mm:ssTZD">
Above, the attribute datetime displays the datetime −
- YYYY - year
- MM - month
- DD - day of the month
- hh - hour
- mm - minutes
- ss - seconds
- TZD - Time Zone Designator
You can also set PTDHMS −
- P - prefix for "Period"
- D - prefix for "Days"
- H - prefix for "Hours"
- M - prefix for "Minutes"
- S - prefix for "Seconds"
Let us now see an example to implement the datetime attribute of the <time> element −
Example
<!DOCTYPE html> <html> <body> <h2>Exam Results</h2> <p><s>Result would be announced on 6th June.</s></p> <p>New date for results is next <time datetime="06-15">Saturday</time>.</p> </body> </html>
Output
Advertisements