Convert timestamps into time-group IDs