A 2 year old can go as long as 6 hours in some cases without a wet diaper.
However most often a 2 year old will only go as long as 2 hours to 3 hours without a wet diaper depending on how much they drink.
If it's hot outside then the 2 year old will sweat more and not produce as much urine and so they may go a few hours or even 4 hours without a wet diaper which is normal.
Some 2 year olds pee as often as every 20 to 30 minutes and some go as long as 1 hour to 2 hours and even 3 hours without peeing.
It is normal for a 2 year old boy to go 2 hours and sometimes even as long as 3 hours with a dry diaper before they pee.
My 2 year old sometimes goes 2 hour and sometimes as long as 3 hours before he wets his diaper.
At 2 years old they sometimes hold the pee in for a few hours and then once they feel their bladder filling up and get the urge to pee they then let lose.
If the 2 year old boy has not peed within 6 hours then I would be concerned about dehydration.
But sometimes toddlers and 2 year olds pee different amounts during the day.
Some days my 2 year old son pees every 30 minutes and has a wet diaper ever few hours and then some days he just does not pee as often and can have a dry diaper for 2 to 3 hours.
As long as you're keeping your toddler hydrated with water, juice etc then they should be okay.
But if the 2 year old boy has no wet diapers within 6 to 8 hours then I would take them to the doctor or urgent care to be checked out.
Some 2 year olds go through 4 to 5 diapers per day while some days some 2 year olds pee less and may only go through 2 to 4 diapers per day.