HTML Time Tag
The HTML <time> tag is used to represent a specific time, date, or both. It can be used for various purposes, such as indicating the publication date of an article, setting up reminders, or displaying event dates. The <time> tag can also include a datetime attribute, which provides a machine-readable format of the date or time.
2024-08-21 19:05:48 - Sakala Code
HTML Time Tag Attributes
Datetime: This optional attribute represents the date and/or time in a machine-readable format (e.g., YYYY-MM-DDTHH:MM for a specific date and time). If the datetime attribute is not provided, the content inside the <time> tag is considered as the human-readable date or time.
HTML <time> Tag with Example:
Representing a Specific Date:
<p>Published on: <time datetime="204-03-29">March 29, 2024</time></p>
HTML Representing a Specific Time:
<p>The event starts at <time datetime="13:00">1:00 PM</time>.</p>
HTML Representing Date and Time:
<p>Meeting scheduled for <time datetime="2024-09-01T14:00">September 1, 2024, at 2:00 PM</time>.</p>
HTML Representing a Time Duration:
<p>Estimated reading time: <time datetime="5M">5 minutes</time></p>