I have a message board site and wanted to incorporate some schema to its posts. One of the main attributes for posts is the time in which they're creating in.

With that being said I came across the dateCreated property. The one issue I'm facing in the formatting requirements. The expected type is either Date or DateTime. For UX purposes I was interested in displaying the post date in time ago in words. So instead of:

October 21, 2015, 7:28 AM

I would do something like:

5 minutes ago

Would I still be able to do something like the latter since it isn't exactly in date format?


You can give the DateTime as property value (for the structured data / for machines), while displaying a human-readable variant.

Microdata and RDFa will take the time element’s datetime attribute value as property value, not the element content:

<!-- Microdata -->
<time itemprop="dateCreated" datetime="2015-10-21T07:28:00">5 minutes ago</time>

<!-- RDFa -->
<time property="dateCreated" datetime="2015-10-21T07:28:00">5 minutes ago</time>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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