title: Firebase WEB , Group By child records by Date ,Month ,Year
body: <p>I have node '<strong>messages</strong>'  , and it will have multiple records with timestamp. I need to group by records by date,month, year as like below</p>
  
  <pre><code>12 July, 2016
  13 July, 2016
  14 July, 2016
  .....
  </code></pre>
  
  <p>My records look like </p>
  
  <pre><code>{
    "messages" : {
      "233110" : {
        "-KMU3Tfp7Sk8DzT0Z_lu" : {
          ".priority" : 1468326341669,
          "message" : "hi",
          "timestamp" : 1468326341669
        },
        "-KMU3_u-x4RAWXw78MHe" : {
          ".priority" : 1468326371206,
          "message" : "yes",
          "timestamp" : 1468326371206
        },
  }      
  </code></pre>
  
  <p>I would like to display these message </p>
  
  <pre><code>12 July, 2016
      Hi
      Yes
      ....
  
  13 July, 2016
      Hi
      Yes
      ....
  </code></pre>
  
  <p>My code :</p>
  
  <pre><code>var temp_array = new Array();
  var m_array = new Array();
  chat.messageRef.child(roomId).on('child_added', function(snapshot,prevChildKey) { 
      var msg    = snapshot.val();
      var d      = new Date(msg.timestamp);
      var month  = d.getDate() +' '+chat.monthNames[d.getMonth()] + ", " + d.getFullYear();
      m_array.push(msg);
      temp_array[month] = m_array;
  });    
  console.log(temp_array); 
  </code></pre>