# How do I put a date column from a collection as a header for a XHTML Table?

**URL:** <https://www.ruby-forum.com/t/how-do-i-put-a-date-column-from-a-collection-as-a-header-for-a-xhtml-table/120869>\
**Category:** Rails\
**Created:** [November 21, 2007, 10:41am UTC](https://www.ruby-forum.com/t/how-do-i-put-a-date-column-from-a-collection-as-a-header-for-a-xhtml-table/120869 "2007-11-21T10:41:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tonkatsufan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a4c791/32.png) [@Tonkatsufan](https://www.ruby-forum.com/u/Tonkatsufan)\
**Post date:** [November 21, 2007, 10:41am UTC](https://www.ruby-forum.com/t/how-do-i-put-a-date-column-from-a-collection-as-a-header-for-a-xhtml-table/120869/1 "2007-11-21T10:41:52Z")

</div>

Hi,

what’s the best way to achieve this. Say I have a data collection  
ordered by a date column (ASC or DESC) like this one.

## Date;Name;Amount

20071001;John;500  
20071001;Jim;400  
20070902;Bob;300  
20070901;Ron;700

Now, I want to output an XHTML Table which groups the records by date,  
effectively rendering a table row with only the date as a headline:

# Name - Amount

## October 01, 2007

## John - 500 Jim - 400

## September 02, 2007

## Bob - 300

## September 01, 2007

Ron - 700

…etc.

As this snippet will repeat itself, I would like to come up with a  
helper which I send the collection to, and the date column to make  
headers from, and get the above output back.

Some hints in the right direction would be highly appreciated.

Thanks a lot,  
Manuel
