If I want to sell some stocks to buy other stock do I have to pay taxes on the profits from the sale of the first stock? 

How long can I keep the cash in my brokerage without having to pay taxes on it? (In other words do I only have so long to decide on which other stock to purchase?)