<p>Following from Lindsey D's answer, I just wanted to point out you can skip manually mapping the weekday names by calling <code>craft.i18n.getLocaleData().getWeekDayName()</code> like so:</p>

<pre><code>{% set day = craft.i18n.getLocaleData().getWeekDayName(dayIndex) %}
</code></pre>

<p>It's also worth mentioning, you can check for empty values to indicate the store is closed.</p>

<p>E.g.,</p>

<pre><code>{% for dayIndex,dayHours in companyInfo.storeHours %}

  {% set day = craft.i18n.getLocaleData().getWeekDayName(dayIndex) %}

  {{day}}: {{ (dayHours.open is empty) ? 'CLOSED' : dayHours.open|date('g:i a') ~ '-' ~ dayHours.close|date('g:i a') }}

  &lt;br&gt;

{% endfor %}
</code></pre>

CC BY-SA 3.0
2016-03-07T19:50:02.133Z
Is there a way to get {% set day = craft.i18n.getLocaleData().getWeekDayName(dayIndex) %} to start on Monday instead of Sunday?
Andrea DeMers
CC BY-SA 3.0
2015-02-13T19:19:24.757Z
2015-02-13T19:19:24.757Z
Alex S
<p>The <code>openTime</code> data is being stored as a numerically-indexed array. You may even want to create a mapping of those days to make rendering each day easier:</p>

<pre><code>{% set days = {
    0: 'Sunday',
    1: 'Monday',
    2: 'Tuesday',
    3: 'Wednesday',
    4: 'Thursday',
    5: 'Friday',
    6: 'Saturday'
} %}
</code></pre>

<p>Then you can adjust your <code>for</code> loop like this:</p>

<pre><code>{% for dayIndex,openTime in entry.openTimes %}

    {% set day = days[dayIndex] %}
    {% set hours = openTime.open|date('g:i a') ~ ' - ' ~ openTime.close|date('g:i a') %}

    {{ day }}: {{ hours }}&lt;br/&gt;

{% endfor %}
</code></pre>

<p><strong>Pro Tip:</strong></p>

<p>If you have <a href="http://buildwithcraft.com/help/dev-mode" rel="noreferrer">dev mode</a> enabled, you can use <code>dump</code> to see what a variable contains.</p>

<pre><code>{{ dump(anyVariable) }}
</code></pre>

<p>That's how I figured out the underlying structure of the <code>openTime</code> data.</p>

CC BY-SA 3.0
2014-09-19T05:03:21.107Z
2014-09-19T05:03:21.107Z
Lindsey D
<p>Anyone using the "Store Hours" plugin know how to print out day open and close hours details?</p>

<p>I have tried this but not outputting anything.</p>

<pre><code>{% for openTime in entry.openTimes %}
    {{openTime.day.open}}&lt;br&gt;
{% endfor %}  
</code></pre>

<p>Note: openTimes is a field of StoreHours type.</p>

<p>Any help will be appreciated.</p>

CC BY-SA 3.0
2014-09-19T03:16:37.087Z
Have you reached out the to plugin developer? Is there a link (github or otherwise) for this plugin?
Adam McCombs
CC BY-SA 3.0
2014-09-19T03:29:11.020Z
Pixel and Tonic are the developers of this plugin. I thought this is the best place to ask. On the github page there is no info about outputting in twig template
Silvanus Matiku
<plugins>
Store Hours Plugin - Output Details
# Store Hours Plugin - Output Details

(Asked by: username_0 on 2014-09-19)

Anyone using the "Store Hours" plugin know how to print out day open and close hours details?
I have tried this but not outputting anything.
{% for openTime in entry.openTimes %}
    {{openTime.day.open}}
{% endfor %}  

Note: openTimes is a field of StoreHours type.
Any help will be appreciated.

**Tags:** plugins

> **Comments:**
> **username_1**: Have you reached out the to plugin developer? Is there a link (github or otherwise) for this plugin?  
> **username_0**: Pixel and Tonic are the developers of this plugin. I thought this is the best place to ask. On the github page there is no info about outputting in twig template  

---

## 2 answers

### Answer by username_4 on 2014-09-19. Score: 5 | Accepted answer

The openTime data is being stored as a numerically-indexed array. You may even want to create a mapping of those days to make rendering each day easier:
{% set days = {
    0: 'Sunday',
    1: 'Monday',
    2: 'Tuesday',
    3: 'Wednesday',
    4: 'Thursday',
    5: 'Friday',
    6: 'Saturday'
} %}

Then you can adjust your for loop like this:
{% for dayIndex,openTime in entry.openTimes %}

    {% set day = days[dayIndex] %}
    {% set hours = openTime.open|date('g:i a') ~ ' - ' ~ openTime.close|date('g:i a') %}

    {{ day }}: {{ hours }}

{% endfor %}

Pro Tip:
If you have dev mode enabled, you can use dump to see what a variable contains.
{{ dump(anyVariable) }}

That's how I figured out the underlying structure of the openTime data.


---

### Answer by username_2 on 2015-02-13. Score: 6

Following from username_4's answer, I just wanted to point out you can skip manually mapping the weekday names by calling craft.i18n.getLocaleData().getWeekDayName() like so:
{% set day = craft.i18n.getLocaleData().getWeekDayName(dayIndex) %}

It's also worth mentioning, you can check for empty values to indicate the store is closed.
E.g.,
{% for dayIndex,dayHours in companyInfo.storeHours %}

  {% set day = craft.i18n.getLocaleData().getWeekDayName(dayIndex) %}

  {{day}}: {{ (dayHours.open is empty) ? 'CLOSED' : dayHours.open|date('g:i a') ~ '-' ~ dayHours.close|date('g:i a') }}

  

{% endfor %}

> **Comments:**
> **username_3**: Is there a way to get {% set day = craft.i18n.getLocaleData().getWeekDayName(dayIndex) %} to start on Monday instead of Sunday?  

---

