Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
    
Any of the formats mentioned in the HTML5 spec will do. –  Yannis Rizos Aug 27 '12 at 8:19

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.