Different (type of) openinghours per day using schema.org

Flo picture Flo · Jun 12, 2013 · Viewed 7.7k times · Source

I use microdata and specifically the LocalBusiness schema on my site. I was also reading this: schema.org: Multiple opening hours on same day

But what I want is to define per day what the opening hours are, since they may vary a lot.

What I currently see in other examples is:

<time itemprop="openingHours" datetime="Tu-Fr 10:00-14:00">XYZ</time>

Can I also use either of these options?

<time itemprop="openingHours" datetime="Tu 10:00-14:00">XYZ</time>
<time itemprop="openingHours" datetime="Fr 11:00-14:00">XYZ</time>

or this

<meta itemprop="openingHours" content="Tu 10:00-14:00">XYZ
<meta itemprop="openingHours" content="FR 11:00-14:00">XYZ

And not only that, on some days a business might be only open by appointment. How to specify that? I'm assuming when I leave a day out in my <time> specification it will be interpreted as closed, but by appointment I don't know.

** UPDATE **

I now have this:

<div itemprop="openingHoursSpecification" itemscope="" itemtype="http://schema.org/OpeningHoursSpecification">
<link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday">
<time datetime="07:00">07:00</time> - <time datetime="01:00">01:00</time>
</div>

with Google rich snippet tool I now see

Item type: http://schema.org/localbusiness
property:
name: Syriana
description:
address: Item 1
openinghoursspecification: Item 2
openinghoursspecification: Item 3

Item 2
type: http://schema.org/openinghoursspecification
property:
dayofweek: http://purl.org/goodrelations/v1#Monday

I see the day, but not the time in the rich snippet tool...why?

Answer

kzh picture kzh · Jun 17, 2013

The LocalBusiness example has been updated and shows an example of multiple times for a span of days.

<div itemscope itemtype="http://schema.org/Restaurant">
  <span itemprop="name">GreatFood</span>
  ...
  Hours:
  <meta itemprop="openingHours" content="Mo-Sa 11:00-14:30">Mon-Sat 11am - 2:30pm
  <meta itemprop="openingHours" content="Mo-Th 17:00-21:30">Mon-Thu 5pm - 9:30pm
  <meta itemprop="openingHours" content="Fr-Sa 17:00-22:00">Fri-Sat 5pm - 10:00pm
</div>

More from the description of openingHours:

The opening hours for a business. Opening hours can be specified as a weekly time range, starting with days, then times per day. Multiple days can be listed with commas ',' separating each day. Day or time ranges are specified using a hyphen '-'.

  • Days are specified using the following two-letter combinations: Mo, Tu, We, Th, Fr, Sa, Su.
  • Times are specified using 24:00 time. For example, 3pm is specified as 15:00.
  • Here is an example: Tuesdays and Thursdays 4-8pm.
  • If a business is open 7 days a week, then it can be specified as Monday through Sunday, all day.

Although the openingHours description uses the time element with the datetime attribute, the weekly time range is not a valid value, so using a meta element may be preferable.

In addition, all Item-Types that derive from Place also have an openingHoursSpecification property. It is much more wordy than the openingHours property. This cane be used somewhat like this:

<div itemscope itemtype="http://schema.org/Restaurant">
  <span itemprop="name">GreatFood</span>
  ...
  Hours:
  <div itemprop="openingHoursSpecification" itemscope
       itemtype="http://schema.org/OpeningHoursSpecification">
    <meta itemprop="description" content="Lunch Hours">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Wednesday">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Thursday">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Friday">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Saturday">

    Mon-Sat
    <time itemprop="opens" datetime="11:00">11am</time> -
    <time itemprop="closes" datetime="14:30">2:30pm</time>
  </div>
  <div itemprop="openingHoursSpecification" itemscope
       itemtype="http://schema.org/OpeningHoursSpecification">
    <meta itemprop="description" content="Supper Hours">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Monday">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Tuesday">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Wednesday">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Thursday">

    Mon-Thu
    <time itemprop="opens" datetime="17:00">5pm</time> -
    <time itemprop="closes" datetime="21:30">9:30pm</time>
  </div>
  <div itemprop="openingHoursSpecification" itemscope
       itemtype="http://schema.org/OpeningHoursSpecification">
    <meta itemprop="description" content="Weekend Supper Hours">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Friday">
    <link itemprop="dayOfWeek" href="http://purl.org/goodrelations/v1#Saturday">

    Fri-Sat
    <time itemprop="opens" datetime="17:00">5pm</time> -
    <time itemprop="closes" datetime="22:00">10:00pm</time>
  </div>
</div>