There's no exact time when pipes can freeze, it depends with the kind of weather, especially how cold outside could be.
When the weather is cold, the pipe becomes unable to withstand the exalted pressure. Through the freezing water, ice forms causing the pipes to burst.
There are other factors that facilitate bursting of pipes and they include, ice blockage,increased pressure and closed outlet.
There are several ways of preventing pipes from freezing but the main one is lagging. Insulating the pipes from the cold water outside.