It typically takes 4-6 months for a puppy to be fully house trained, but some puppies may take up to a year. Size can be a predictor. For instance, smaller breeds have smaller bladders and higher metabolisms and require more frequent trips outside. Your puppy's previous living conditions are another predictor. You may find that you need to help your puppy break old habits in order to establish more desirable ones.
Don’t punish your dog if they pee inside. Regardless of all those old training ideas punishment isn’t a good deterrent for house training. Yelling at your dog after the fact just confuses them and makes them nervous around you. If you catch your did in the act you can try to get their attention & move them outdoors. If you’re successful & they continue going once you get outside praise them like crazy.
Consistency and Patience. Never scold or punish your puppy for mistakes and accidents. The older your pup gets, the more he will be able to control his bladder and bowels. Eventually your pup will have enough control that he will be able to "hold it" for longer and longer periods of time. Let your puppy do this on his own time. When training is rushed, problems usually develop. Don't forget, most puppies are not completely house trained until they are 6 months old.
Pay attention to your puppy while you're waiting for him to do his business. Sometimes, especially in the beginning, you might have to wait a little while before your puppy gets around to using the toilet. You can do some exercises or some light gardening, but keep on eye on your puppy because you'll want to take him back in as soon as he's finished.
Just because your new dog is old enough that he should know where to potty doesn’t mean that he actually does. An adult dog has the necessary muscle control to hold it for longer periods of time, but if no one ever taught him the potty training rules then he’s the equivalent of a brand new puppy. Age should not be equated with housetraining prowess, so it’s a good idea to treat any dog new to your home as if he’s still learning the potty training ropes.