How long it takes to train a pet depends on the type of pet, its age, and whether it has been previously trained, and what type of training you are considering.
It takes only a few minutes to train a cat to use a litter box; you simply fill the litter box with clean litter and place the cat in the box once. As cats are naturally quite fastidious, it is rare for them to have accidents, and usually is a sign that the cat is ill or that the litter is dirty and needs changing.
It takes longer to train puppies, but most can learn to use a training pad or go outside in less than a month, assuming you use proper training techniques.
More complex training, such as teaching dogs to walk on a leash without tugging or to do tricks, make take several weeks or even months.