And we know that for sure, because??? It seems that 12 years, give or take, more than 2000 years ago makes a pretty tight time frame, considering that scripture also recounts a heavenly star that led the Eastern kings to the crib. Isn't it possible that Halley's Comet and the Christmas Star are one and the same?
They probably went back and looked at ancient records, in addition to simple math.
But there is a good clue in the scriptures as to what might have been going on: The wise men or magi were Persian priests or astrologers. The "star" may have been something of astrological significance, such as a planetary conjunction. My memory is faulty at this point, but I recall there being a triple conjunction of Jupiter and Saturn which supposedly indicated a royal birth in Judea.
This all assumes that the Star of Bethlehem and the magi weren't just a bit of legendary material that made its way into the Gospel. (Being an evangelical Christian, I'm inclined to lean towards the reliability of the Gospels; but I'm not a hard-bitten inerrantist concerning the Bible either, and I think astrology is stupid if not demonic.)