<time> : Time (Date) element

Introduction

The <time> element in HTML is used to represent dates and times in a machine-readable format. It allows you to specify a specific point in time, a duration, or a range within a document. The content inside the <time> element can be a specific date and time, a duration, or a combination of both.

Here are a few examples of how you might use the <time> element:

1. Specific Date and Time:

Output :

2. Duration:

Output :

3. Range:

Output :

In each of these examples, the datetime attribute is used to provide the machine-readable date and time format in the ISO 8601 format. This format allows browsers and other user agents to parse and understand the date and time information, aiding accessibility and search engine optimization.

The content inside the <time> element is typically displayed to users as-is, providing human-readable information about dates, times, durations, or ranges. However, it’s important to note that the datetime attribute is what conveys the machine-readable information, making it useful for developers and assistive technologies.

Leave a Comment