StackOverflow 29213593
HTML
<script src="https://cdn.firebase.com/js/client/2.2.3/firebase.js"></script>
JavaScript
var ref = new Firebase('https://stackoverflow.firebaseio.com/29213593/');
function createSampleData() {
var timestamp = Date.now();
for (var i=0; i < 100; i++) {
ref.push({ user: Math.round((Math.random() * 100)), timestamp: timestamp });
timestamp = timestamp - 1000 - 10 * Math.round((Math.random() * 1000));
}
}
createSampleData();
var startTime = 1427138419385,
endTime = startTime + 60 * 1000;
ref
.orderByChild('timestamp')
.startAt(startTime)
.endAt(endTime)
.once('value', function(snap) {
console.log('There are ', snap.numChildren(), ' messages in range', snap.val());
});