Need to access year/month variable when grouping entries by date
If I understand your example correctly, a simple hyphen would do the trick &mdash; "YYYY-MM" is a format the date filter recognizes.

{% set entries = ... %}
{% set entriesByMonth = entries|group('postDate|date("Y-m")') %}
{% for month, entries in entriesByMonth %}
  &lt;li&gt;
      &lt;a href="{{ month|date("Y") }}/{{ month|date("m") }}"&gt;
        {{ entries | length }} entries in {{ month|date("F Y") }}
      &lt;/a&gt;
  &lt;/li&gt;
{% endfor %}