Pages

Wednesday, May 14, 2014

A Short Guide to Date, Times and Durations Schema

Making your website's content semantically richer is one of the best ways to enable Google to easily understand the contents of your web page. Schema markup is used to tag particular pieces of information together so that the search engines are able to determine exactly what the content denotes. This tutorial will explore the possible schema mark up usage for dates, times and durations.

DATE

Different countries follow different patterns for displaying date values so it becomes difficult for international search engines like Google to predict the exact date value. As for example, the date "06/08/92", does it means 6th August, 1992 or 8th, June, 1992? Confused!!

Schema markup makes it simpler for search engines to follow a same pattern for predicting date values.

Syntax for Date:

<time datetime="YYYY-MM-DD">--//--//--</time>

Example:

<time datetime="1992-08-06">06/08/92</time>

The above HTML code denotes that the date unambiguously as 6th, August, 1992.

TIME

Time can be denoted using 2 ways as given below:

1- Specyfying a time within a day

In order to specify a time of the day like Dec 1st, 2001, 4:30 PM, we will use the following markup:

Syntax:

<time datetime="YYYY-MM-DDThh:mm or hh:mm:ss">//--//--//</time>

Here:

T stands for Time and Time values are prefixed with the letter T.

Example:

<time datetime="2001-12-01T16:30">Dec 1st, 4:30pm</time>

The above HTML code denotes that the time as 4:30 PM.

2- Specyfying a time in an analogous way (DURATION)

Suppose you wish to specify a time as 2 hours 15 minutes in order to denote a recipe cooking time. In that case, we will use the following markup:

Syntax:

<time itemprop="cookTime" datetime="PT1H30M">//--//</time>

Here:

P stands for period because durations are prefixed with the letter P.

Example:

<time itemprop="cookTime" datetime="PT2H15M">2 hrs 15 mins</time>

Hope this helps to understand the basics of data, time and durations schema.