They normally schedule a planned c section at 39 weeks. This will vary based on your drs concerns and your personal circumstances (like are you high risk, is baby breech, is mom or baby in distress etc) If you go into labor before the scheduled c section they will treat it just as an emergency one and start prepping for it as soon as you get there. You will labor in the hospital room until they are ready for you. Don't worry they can still do one if baby decides to come early :)
I never had one before but I think it's around a week before just in case so you can have a c section before you go into labor. I don't kno anyone who had a planner c section before so I know I'm not the best person to say anything