According to Matthew, the Magi from the east came to Jerusalem to see the one who was born King of the Jews (Matthew 2:1-2). This caused quite a stir with Herod, the king, and those who dwelt in Jerusalem (Matthew 2:3). There are a few things that must be understood about this incident in Matthew in order to know the time of the Magi’s visit and the star they saw in the east.
First of all, nobody knew of this star except the Magi who studied the heavens. This would rule out a bright nova or a visible comet. It must concern either a new star in the heavens, or a rare mass of planetary conjunctions among the heavenly constellations. We can probably rule out a new star being significant, since it would have been a one-time occurrence, and its interpretation would have had to be solely dependent upon the individual astrologer/Magi. In other words, chances are we would not understand why they came to the conclusion they did concerning Jesus’ birth, because the interpretation would have been a personal matter like tasting food, or the beauty of an object etc. Therefore, assuming these conclusions are correct, the star was probably a planet making a number of rare conjunctions with other planets and stars in a particular constellation.
Second, although the Magi were aware of this star, they could not have been following it from east to west, because the normal motion of the planets against the fixed starry sky is from west to east. While it is true that the starry sky has an apparent motion from east to west (like the Sun), this has to do with the rotation of the earth and not the motion of the planets. Therefore, the star could not have lead them to Jerusalem as it moved through the heavenly sky.
Third, if the star were a planet it would be quite odd for the Magi to rejoice at its sight when they left off speaking with Herod (Matthew 2:10). After all, they could see the star or planet any morning before sunrise in the eastern sky. So, what caused the Magi to rejoice at the sight of the star on this particular day? I believe it was because of where they were in Jerusalem. They were in western Jerusalem, as guests at Herod’s palace. They may have spoken with him on the previous evening, stayed with him overnight and rose early to study the planetary positions when they saw Jupiter (the presumed Christmas “star”) rising above Mount Olivet. At that moment they were in position for the very first time on their journey for the star to lead them anywhere.
They assumed the new King would have been in the palace at Jerusalem, but all they found there were a very concerned Herod and some troubled priests and scribes, whom Herod had gathered together for advice. Nevertheless, since the Magi were at this time in western Jerusalem, for the first time since they embarked on their journey, the star was positioned to lead to them to the King as it traveled through the heavens. It dawned on them as they observed its position over the Jerusalem sky that it stood in the east over the House (Matthew 2:11), i.e. the Temple. They rejoiced, because they suddenly realized that they should have been looking for the Messiah in his Father’s House not in Herod’s palace. Sometimes we just don’t think of what is true, until we see it unfold before our very eyes. The Magi were directed to Bethlehem, but how could the star lead them to Bethlehem, which is south of Jerusalem? They may have gone to Bethlehem on the word of the priests and scribes, but the text says that the star “went before them in the east until it appeared to stand over the place where the child was” (Matthew 2:9). They rejoiced exceedingly (v.10) and went into the House and found the child with his mother, Mary (v.11)! The Temple is often referred to as “the House” in Scripture (Ezekiel 47:1; Psalm 93:5).
 This is the position the late Dr. Ernest Martin took in his book: The Star that Astonished the World.