Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What’s the point of using the HTML5 <time> tag?

Tags:

html

I have been going through some tutorials on the <time> tag, but I honestly don't see why we are using it.

For example:

Published <time pubdate datetime="2011-07-03">07/03</time> 

If we are going to have a string 07/03 anyway, what is the purpose of using a time tag? It doesn't validate anything.

like image 893
CppLearner Avatar asked Jul 28 '11 00:07

CppLearner


People also ask

Why do we use time tags in HTML?

The <time> HTML element represents a specific period in time. It may include the datetime attribute to translate dates into machine-readable format, allowing for better search engine results or custom features such as reminders. It may represent one of the following: A time on a 24-hour clock.

What is data time in HTML?

Definition and Usage. The datetime attribute represent a machine-readable format of a <time> element.

How do you show time in HTML?

Current Date and Time is stored inside javascript variable. Then using TextContent property the content of HTML span element is set with current and time. Unique ID is given to span tag so that we can use it on getElementById() method to dispaly the current date and time.

How do you write date and time in HTML?

The <time> datetime Attribute in HTML is used to defines the machine-readable date/time of the <time> element. The date-time is inserted in the format YYYY-MM-DDThh:mm:ssTZD.


1 Answers

The point of this tag, as with a number of the new "semantic" HTML5 tags, is to make it easier for programs to index your data.

A script can go through and easily find out what the published date is for your blog articles if it sees a <time> tag, without having to parse any of a number of ways this could be represented (for consumption by a human being), which would be a much more complex and error-prone task.

like image 54
Jeremy Roman Avatar answered Oct 05 '22 00:10

Jeremy Roman