How long does it normally take to realize that a baby has pyloric stenosis?

Varies. Pyloric stenosis often causes projectile vomiting, forceful ejection of milk or formula up to several feet away. Vomiting occurs within 30 minutes after baby eats. Vomiting may be mild at first and gradually become more severe as the pylorus opening narrows.Can take days to sometimes week or so.
3 weeks to 3 months. Pyloric stenosis occurs in newborns, typically born at term, anywhere from 3 weeks to 3 months of age. Some babies will tolerate some feedings between their emesis spells, so the time to diagnosis can vary. The symptom is usually progressive, projectile, non-bilious emesis.
1º 4 weeks of life. The most striking symptom of pyloric stenosis is vomiting, sometimes so forceful it is projectile, going several feet from the baby. This in turn causes dehydration and electrolyte imbalance the average is about 3 weeks but it can be seen as far as 6 weeks of life. It is more common in firstborn boys and can be seen in families, it can happen in 3 out of 1000 babies.
2 - 3 weeks of life. Most newborns vomit. Normal vomiting will respond to simple measures such as changing formula or adding rice cereal to treat reflux. If it gets worse over time and tends to be more frequent and forceful and the infant is losing weight, peeing less, and stooling less then an ultrasound is needed. Pyloric ultrasound will identify abnormalities in the muscle thickness and length.