I currently have the following HTML code
<time datetime="2012-08-23">
23. August 2012
</time>
I have that because I felt the “23. August 2012” format was easier for website visitors to read than
<time>2012-08-23</time>
Both of those HTML5 examples validate at w3, but the first one is obviously redundant, and I like to cut out markup I don’t need. Is there another date formate that I can use in the second example that is (1) easy for website visitors to read, and (2) w3 valid?
1
You have two possibilities. First you can use the attribute “datetime” and the content as free text. On the other hand you have the option to use the content only. With the content only you need to fill in a valid format for the datetime. Currently it has the following format:
YYYY-MM-DDThh:mm:ssTZD
In time, no common browser is supporting this tag by default. I could think that there will maybe a time where the tag can handle current culture and different time formats as well. But in time it’s not specified.
Therefore you only have the possibility to do it with that kind of redundancy, to stay HTML-conform. Sorry for that.
0