What HTML tag is the right one to place a date? [closed]

-1

Is this okay? :

<time>6 Sep 2017</time>

Or could it be any other, for example a <p> <span> ? is that I want to consider semantics

    
asked by user58706 06.09.2017 в 22:56
source

2 answers

1

According to your comment use the time HTML5 tag: to represent a date and / or time, this new HTML5 tag does not It must be included in a form.

The dates that we wrap with the time tag must have a certain format to be indexed correctly in the search engines, a format that does not have to be the most appropriate for a reader. To get a more human format on the dates and times we wrap with the time tag of HTML5 we can use the datetime attribute. For example:

<time datetime="2017-09-06">6 de septiembre de 2017</time>
<time datetime="2017-09-06">Hoy</time>
    
answered by 07.09.2017 в 00:23
0

You have to use a date type input

<input type="date" />
    
answered by 06.09.2017 в 23:20