Archive Not Returning Correct Date Variable I'm using the technique for creating an archive that's in the Craft docs: https://craftcms.com/support/entry-archive

I'm archiving by day, so my code looks like this:

{% set agendaEntries = craft.entries.section('agenda').status('live,pending,expired').limit(null) %}

{% for day, entriesInDay in agendaEntries | group('postDate.day') %}
  &lt;h2&gt;{{ day | date('Y-m-d') }}&lt;/h2&gt;

  &lt;ul&gt;
    {% for entry in entriesInDay %}
       &lt;li&gt;
          {# entry data #}
       &lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
{% endfor %}


The looping and grouping (heh) works great, but the {{ day }} variable doesn't correctly output the date, instead I get the day-before-Epoch date (1969-12-31).

I don't really understand how the for loop even knows what the day variable is, so I don't know how to troubleshoot.
Your postDate.day will output the number of the day in the month so if your entries postdate is 02.dd.yyyy your output is 2. Your array index will be something like [2, 3, 5, 12, 31] thus these values will be converted from the timestamp into a readable day with&lt;h2&gt;{{ day | date('Y-m-d') }}&lt;/h2&gt;. The first timestamp (0) is 01.01.1970 because of your timezone you'll see only values around this date since you convert all the day numbers from 1-31 as timestamps to your given format. 

In case you did not know: the day variable represents only the keys of the array and with | group('postDate.day') you define the keys. I think your goal is to have keys like [ 'Monday', 'Tuesday'.... 'Sunday']. Your filter will look like:

{% for day, entriesInDay in agendaEntries | group('postDate|date('l')') %}