Matthew 2:1 Now when Jesus was born in Bethlehem of Judaea in the days of Herod the king, behold, there came wise men from the east to Jerusalem,
They were directed to Bethlehem.
11 And when they were come into the house, they saw the young child with Mary his mother, and fell down, and worshipped him: and when they had opened their treasures, they presented unto him gifts; gold, and frankincense, and myrrh.
13 And when they were departed, behold, the angel of the Lord appeareth to Joseph in a dream, saying, Arise, and take the young child and his mother, and flee into Egypt, and be thou there until I bring thee word: for Herod will seek the young child to destroy him. 14 When he arose, he took the young child and his mother by night, and departed into Egypt:
Luke 2:21 And when eight days were accomplished for the circumcising of the child, his name was called JESUS, which was so named of the angel before he was conceived in the womb. 22 And when the days of her purification according to the law of Moses were accomplished, they brought him to Jerusalem, to present him to the Lord; 23 (As it is written in the law of the Lord, Every male that openeth the womb shall be called holy to the Lord;) 24 And to offer a sacrifice according to that which is said in the law of the Lord, A pair of turtledoves, or two young pigeons.
The procedure required by the Law
Leviticus 12:2 Speak unto the children of Israel, saying, If a woman have conceived seed, and born a man child: then she shall be unclean seven days; according to the days of the separation for her infirmity shall she be unclean. 3 And in the eighth day the flesh of his foreskin shall be circumcised. 4 And she shall then continue in the blood of her purifying three and thirty days; she shall touch no hallowed thing, nor come into the sanctuary, until the days of her purifying be fulfilled…
6 And when the days of her purifying are fulfilled, for a son, or for a daughter, she shall bring a lamb of the first year for a burnt offering, and a young pigeon, or a turtledove, for a sin offering, unto the door of the tabernacle of the congregation, unto the priest: 7 Who shall offer it before the LORD, and make an atonement for her; and she shall be cleansed from the issue of her blood. This is the law for her that hath born a male or a female. 8 And if she be not able to bring a lamb, then she shall bring two turtles, or two young pigeons; the one for the burnt offering, and the other for a sin offering: and the priest shall make an atonement for her, and she shall be clean.
When Jesus was born, he was laid in a manger in a stable, which is where the shepherds found him.
By the time the Magi arrive he is in a house.
Jesus was circumcised on the eighth day and 33 days later was taken to Jerusalem for an offering to be made, following which the family returned to Bethlehem.
After the visit of the wise men, Jesus was taken into Egypt until the death of Herod.
Herod, having waited in vain for the Magi to return, ordered the death of children under the age of two, based on his understanding of when the star first appeared in the east. What margin of error he allowed we are not told.
Matthew 2:16 Then Herod, when he saw that he was mocked of the wise men, was exceeding wroth, and sent forth, and slew all the children that were in Bethlehem, and in all the coasts thereof, from two years old and under, according to the time which he had diligently enquired of the wise men.
We can perhaps assume that the star appeared at the time that Jesus was born.
How long it took the magi to ascertain the meaning of the star, and travel to Bethlehem via Jerusalem we are not told.
Jesus was taken to Egypt in the period of time between the departing of the Magi and Herod’s realisation that they were not returning to him.
Jesus was therefore less than two years old when the Magi arrived, but how much under two years old cannot be determined from the given facts.
I hope you find this helpful.