<pre><code>{% switch entry.postDate|date('M') %}

    {% case 'Dec' or 'Jan' or 'Feb' %}
        {% set season = 'Winter' %}

    {% case 'Mar' or 'Apr' or 'May' %}
        {% set season = 'Spring' %}

    {% case 'Jun' or 'Jul' or 'Aug' %}
        {% set season = 'Summer' %}

    {% case 'Sep' or 'Oct' or 'Nov' %}
        {% set season = 'Fall' %}

{% endswitch %}

&lt;p&gt;{{ season }} {{ entry.postDate|date('Y') }}&lt;/p&gt;
</code></pre>

CC BY-SA 3.0
2016-03-19T04:39:45.447Z
That is way simpler than what I would have tried. Thanks!
jasonetco
CC BY-SA 3.0
2016-03-20T08:50:00.263Z
Wow. Didn't actually know you could have an `or` statement inside a `{% case %}` tag. +1, Lindsey!
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2016-03-20T14:46:01.163Z
@MatsMikkelRummelhoff: That's a brand new feature as of Craft 2.6!
Lindsey D
CC BY-SA 3.0
2016-03-19T03:32:54.553Z
2016-03-19T03:32:54.553Z
Lindsey D
<p>I'd like to get an output of <strong>Spring 2015</strong> from a post entry that was written in March. Here is a JavaScript solution</p>

<p><a href="http://jsfiddle.net/RtC58/3/" rel="nofollow">http://jsfiddle.net/RtC58/3/</a></p>

<p>But I'm hoping I can do something in the template instead. Thanks!</p>

<templating>
Output season name from entry date
# Output season name from entry date

(Asked by: username_0 on 2016-03-19)

I'd like to get an output of **Spring 2015** from a post entry that was written in March. Here is a JavaScript solution

<http://jsfiddle.net/RtC58/3/>

But I'm hoping I can do something in the template instead. Thanks!

**Tags:** templating


---

## 1 answers

### Answer by username_1 on 2016-03-19. Score: 5 | Accepted answer

{% switch entry.postDate|date('M') %}

    {% case 'Dec' or 'Jan' or 'Feb' %}
        {% set season = 'Winter' %}

    {% case 'Mar' or 'Apr' or 'May' %}
        {% set season = 'Spring' %}

    {% case 'Jun' or 'Jul' or 'Aug' %}
        {% set season = 'Summer' %}

    {% case 'Sep' or 'Oct' or 'Nov' %}
        {% set season = 'Fall' %}

{% endswitch %}

{{ season }} {{ entry.postDate|date('Y') }}

> **Comments:**
> **username_0**: That is way simpler than what I would have tried. Thanks!  
> **username_2**: Wow. Didn't actually know you could have an `or` statement inside a `{% case %}` tag. +1, Lindsey!  
> **username_1**: @MatsMikkelRummelhoff: That's a brand new feature as of Craft 2.6!  

---

