I am trying to list the months (January, Febuary etc) between two dates.
I have a start date: 5/4/2015
and an end date: 9/25/2015
.
Using range I am able to return the month numbers, but just can't figure out the correct syntax to convert 5
into May
.
Here's what I've got so far, maybe there is a better way all together?
TWIG
{% set startMonth = craft.plugin.getStartDate() %} // returns 5/4/2015
{% set endMonth = craft.plugin.getEndData() %} // returns 9/25/2015
{% for month in range(startMonth, endMonth, 1) %}
{{ month }} // returns 5 6 7 8 9
{% endfor %}
I've tried doing something like: {{ month|date('F') }}
but that returns December
for each result.
I'll eventually need days within this month range, but I am hoping from this I can figure that out.