At age 2 it might take 2 months, closer to age 3 a child might conquer it in as little as a few days. Discussing it daily and presenting the upcoming plan is essential. The child can take part in choosing new underpants, a small toilet, etc. Try and place a child's toilet in more than one place around the house. Decide on a few hours during the day in which your child will not wear a diaper.
Some parents prefer the morning hours, for others, the afternoon and early evening are favored.
Find the correct balance between being persistent, and not too intruding. No one likes to be constantly bothered, not even young children. On the same token, don't make them feel bad when they fail. Remember how good you feel when someone understands your struggles. Be as compassionate as you'd like someone to be towards you.