I have a column with datetime in a table that has the format:
2012-10-30 08:00:00 UTC
How could I create an array or hash that would collect the times by date:
2012-10-30
8:00
9:00
13:00
2012-11-02
8:00
9:00
In the end I would like to have web output like this:
October 30, 2012
8:00 <reserve button>
9:00 <reserve button>
13:00 <reserve button>
November 2, 2012
8:00 <reserve button>
9:00 <reserve button>
I can figure out the html part if I can get the array correctly setup.
Get all your available timestamps from the table, for example:
Build a Hash by date:
@result will be a Hash by date with available times.
You can now do this in your view: