Search code examples
htmldatelocalemicrodata

The 'datePublished' property and the HTML 'lang' attribute


I was just adding some Microdata to my page and started wondering if the lang attribute affects the Schema.org datePublished property.

I've added the following to my HTML tag:

<html lang="nl">

When I do:

<h5 itemprop="datePublished" content="2015-11-30UTC12:00:00">Nov 30th 2015 12:00am</h5>

it's not written like we do in the Netherlands. We write it like d-m-Y. Do I have to write my datePublished property like that too? How do search engines pick that up?


Solution

  • Microdata doesn’t use the lang attribute.

    And in HTML5+Microdata, you can’t use the content attribute on an h5 element (only on the meta element).

    If you want to provide a date, you should use HTML5’s time element (or meta if it shouldn’t be visible on the page). The time element allows you to provide the machine-readable format in the datetime attribute.

    For your example, it could look like:

    <h5>
      <time itemprop="datePublished" datetime="2015-11-30T12:00:00Z">Nov 30th 2015 12:00am</time>
    </h5>