Answers.Body: <p>I like <strong>conditionals</strong> approach by Victor. Here's the slightly modified version for Craft 2.6:</p>
  
  <pre><code>{% set allEntries = craft.entries.section('blog') %}
  {% set last_date = '' %}
  
  {% for entry in allEntries %}
      {% if last_date != entry.postDate|date('Ymd') %}
  
          This entry is the first of a new day
      {% endif %}
  
      {% set last_date = entry.postDate|date('Ymd') %}
  
      {{ entry.title }}
  {% endfor %}
  </code></pre>
  
  <p>The key (apart from .date being .postDate) is that entry.postDate will render a <em>formatted</em> value like 2017-02-23, however the <em>evaluated</em> value of entry.postDate will be the underlying timestamp, which includes hours/minutes/seconds. This means two entries from the same day may have a postDate that outputs 2017-02-23, but their underlying timestamps will likely have different h/m/s, making comparisons unreliable. Being explicit with postDate output (e.g. 'Ymd', or 20170223) solves the issue. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-22T23:42:44.053Z
Answers.LastActivityDate: 2017-02-22T23:42:44.053Z
Answers.UserDisplayName: user3176488
Answers.Body: <p><strong>Group:</strong></p>
  
  <p>Take a look at Craft's custom <a href="http://buildwithcraft.com/docs/templating/filters#group" rel="nofollow">group filter</a>. Your example could look like this:</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set allEntries = craft.entries.section('blog').find() %}
  {% set allEntriesByDay = allEntries | group('postDate') %}
  
  {% for day, entriesInDay in allEntriesByDay %}
      &lt;h1&gt;{{ day }}&lt;/h1&gt;
  
      {% for entry in entriesInDay %}
          {{ entry.title }}
      {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>.</p>
  
  <p><strong>Conditionals:</strong></p>
  
  <p>You could also save the last entries date and use conditionals:</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set allEntries = craft.entries.section('blog') %}
  {% set last_date = '' %}
  
  {% for entry in allEntries %}
      {% if last_date &lt; entry.date %}
          This entry is the first of a new day
      {% endif %}
  
      {% set last_date = entry.date %}
  
      {{ entry.title }}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-21T16:29:04.263Z
Answers.Text: This might be a dumb question... but how do I reformat the {{ day }} variable in your first example? If I do something like:
      {{ day|date("D") }}
  It changes every instance to the same date.
Answers.UserDisplayName: Jesse Bennett-Chamberlain
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-21T16:42:30.647Z
Answers.Text: @JesseBennett-Chamberlain You're right, my mistake. I accidentally added .day to postDate which means only the numerical value was passed. I edited the answer, it works now.
Answers.UserDisplayName: Victor
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-21T14:59:11.090Z
Answers.LastActivityDate: 2014-06-23T14:58:35.450Z
Answers.LastEditDate: 2014-06-23T14:58:35.450Z
Answers.UserDisplayName: Victor
Body: <p>I'm wondering how I would replicate the ExpressionEngine <a href="http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_entries.html#date-heading" rel="nofollow"><code>date_heading</code></a> tag pair in Craft?</p>
  
  <pre><code>{date_heading}  {entry_date format="%Y %m %d"}  {/date_heading}
  </code></pre>
  
  <blockquote>
    <p>The date heading can be used to show a heading at certain intervals.
    The interval can be set to show hourly, daily, weekly, monthly, or
    yearly.</p>
  </blockquote>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-21T14:50:38.500Z
Comments.Text: Could you clarify the ultimate goal here? Is it to show entries grouped by dates?
Comments.UserDisplayName: Stuart Whitehead
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-06-21T15:02:34.987Z
Comments.Text: Yep... that's exactly what I'd like to do.
Comments.UserDisplayName: Jesse Bennett-Chamberlain
Tags: <date>
Title: How do you replicate the EE {date_heading} tag pair in Craft?
ThreadText: # How do you replicate the EE {date_heading} tag pair in Craft?
  
  (Asked by: username_0 on 2014-06-21)
  
  I'm wondering how I would replicate the ExpressionEngine [`date_heading`](http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_entries.html#date-heading) tag pair in Craft?
  
  ```
  {date_heading}  {entry_date format="%Y %m %d"}  {/date_heading}
  
  ```
  
  > The date heading can be used to show a heading at certain intervals.
  > The interval can be set to show hourly, daily, weekly, monthly, or
  > yearly.
  
  **Tags:** date
  
  > **Comments:**
  > **username_1**: Could you clarify the ultimate goal here? Is it to show entries grouped by dates?  
  > **username_0**: Yep... that's exactly what I'd like to do.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2014-06-21. Score: 7 | Accepted answer
  
  **Group:**
  
  Take a look at Craft's custom [group filter](http://buildwithcraft.com/docs/templating/filters#group). Your example could look like this:
  
  ```twig
  {% set allEntries = craft.entries.section('blog').find() %}
  {% set allEntriesByDay = allEntries | group('postDate') %}
  
  {% for day, entriesInDay in allEntriesByDay %}
      <h1>{{ day }}</h1>
  
      {% for entry in entriesInDay %}
          {{ entry.title }}
      {% endfor %}
  {% endfor %}
  
  ```
  
  .
  
  **Conditionals:**
  
  You could also save the last entries date and use conditionals:
  
  ```twig
  {% set allEntries = craft.entries.section('blog') %}
  {% set last_date = '' %}
  
  {% for entry in allEntries %}
      {% if last_date < entry.date %}
          This entry is the first of a new day
      {% endif %}
  
      {% set last_date = entry.date %}
  
      {{ entry.title }}
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: This might be a dumb question... but how do I reformat the {{ day }} variable in your first example? If I do something like:     {{ day|date("D") }} It changes every instance to the same date.  
  > **username_3**: @username_0 You're right, my mistake. I accidentally added .day to postDate which means only the numerical value was passed. I edited the answer, it works now.  
  
  ---
  
  ### Answer by username_2 on 2017-02-22. Score: 1
  
  I like **conditionals** approach by username_3. Here's the slightly modified version for Craft 2.6:
  
  ```
  {% set allEntries = craft.entries.section('blog') %}
  {% set last_date = '' %}
  
  {% for entry in allEntries %}
      {% if last_date != entry.postDate|date('Ymd') %}
  
          This entry is the first of a new day
      {% endif %}
  
      {% set last_date = entry.postDate|date('Ymd') %}
  
      {{ entry.title }}
  {% endfor %}
  
  ```
  
  The key (apart from .date being .postDate) is that entry.postDate will render a *formatted* value like 2017-02-23, however the *evaluated* value of entry.postDate will be the underlying timestamp, which includes hours/minutes/seconds. This means two entries from the same day may have a postDate that outputs 2017-02-23, but their underlying timestamps will likely have different h/m/s, making comparisons unreliable. Being explicit with postDate output (e.g. 'Ymd', or 20170223) solves the issue.
  
  
  ---
  
  