Bikes arrive in a bike shop partially assembled from the factory via a distributor and require certain parts to be fitted such as bars and stem, seat and post, pedals, front wheel, reflectors. Then everything must be checked over; brakes, gears, spoke tension, check all the nuts and bolts, finish off all the cables... It can take between 15mins and an hour, or even more. Some bikes arrive in a very high state of adjustment. Poor quality bikes take longer to build than good quality bikes because you're building them up to a standard of road-worthiness. The quality of factory assembly is another important factor. If you're having to face disc caliper mounts, tap out frame bosses, align drop-outs, remove cranks to adjust BBs, re-dish wheels, wrap bars.... And if the mechanic has to fit mudguards, rack, bottle cage, lock bracket, lights add another hour. Set-up suspension... swap out saddles, tyres etc...
For a complete scratch build from the ground up including building the wheels - it depends very much on the kind of bike. In reality the preparation takes a while - speccing ,ordering, gathering all the parts. But if we assume that all the parts are to hand - Between 2 and 4 hours.
A frame swap is a different thing altogether. If it's straightforward it can take as little as an hour but they rarely are. Because you might as well fit new cables for example, and a headset regrease while you're there .... the time can increase substantially.
I'd always recommend buying the bike from the people who you want to build it. If there's a problem with it - and it's not uncommon to pull a bike from a box and find it damaged - you'll avoid the enormous hassle of sending the thing back to where you bought it.