How long do Ponyboy and Johnny hide out in the back of the church?
After the fight with the Socs, which leaves Bob dead after Johnny stabs him in self-defense, the boys are terrified. The boys go to Darry for advice and Darry tells them about the church and how to get there. The boys spend several days in the church. During their time in the church, the boys decide to cut and bleach their hair, in order to try to make it easier to avoid the cops, who must (they think) be on the lookout for them.
On the fifth day, Darry comes out to see the boys and they leave the church to go get lunch with him. When they return, they see that the church is on fire and they work hard to rescue the kids they believe are trapped inside.
So, the short answer is, they were in the church for five days.