When was Jesus born?
Luke 2:1-5 (KJV): (1) And it came to pass in those days, that there went out a decree from Caesar Augustus that all the world should be taxed.
(2) (And this taxing was first made when Cyrenius was governor of Syria.)
(3) And all went to be taxed, every one into his own city.
(4) And Joseph also went up from Galilee, out of the city of Nazareth, into Judaea, unto the city of David, which is called Bethlehem; (because he was of the house and lineage of David

(5) To be taxed with Mary his espoused wife, being great with child.
According to wikipedia: "The Census of Quirinius refers to the enrollment of the Roman Provinces of Syria and Iudaea for tax purposes taken in the year 6/7 during the reign of Emperor Augustus (27 BC - AD 14), when Publius Sulpicius Quirinius was appointed governor of Syria, after the banishment of Herod Archelaus and the imposition of direct Roman rule."
---------------------
Matthew 2:16-18 (KJV): (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 inquired of the wise men.
(17) Then was fulfilled that which was spoken by Jeremiah the prophet, saying,
(18) In Rama was there a voice heard, lamentation, and weeping, and great mourning, Rachel weeping for her children, and would not be comforted, because they are not.
According to Wikipedia: "The Massacre of the Innocents is an episode of infanticide by the King of Judea, Herod the Great, that appears in the Gospel of Matthew Matthew 2:16-18. ...There is no contemporary evidence for the Massacre. The first account of the Massacre comes in the Gospel of Matthew, which was written some 80 years after the alleged Massacre. Herod the Great (73 BC – 4 BC)..."
So Mary and Joseph went to Bethlehem to participate in a giant census in the year 6 or 7 AD. Let's put aside the fact that there's no contemporary evidence or conceivable reason that the Romans would require everyone to travel to their
ancestral homes, places they have
never lived in, in order to be counted. So Mary and Joseph are travelling for the census. It is the year 6 or 7 AD. Jesus isn't born yet. Later, after Jesus was born, Herod orders the Massacre of the Innocents. Oh did I say later? I meant before. Because Herod as around from 73BC-4BC...BEFORE the census that drove Mary and Joseph to Bethlehem. Again, we're putting aside the fact that there is no contemporary evidence for the massacre outside of Matthew (and that was written 80 years after the supposed events). Josephus doesn't mention it and he's always touted as the great non-Biblical historical evidence for Jesus. Not even Luke mentions the massacre in his gospel.
here is an answer for the alleged world wide census
"LUKE 2:1—Did Luke make a mistake when he mentioned a worldwide census under Caesar Augustus?
PROBLEM: Luke refers to a worldwide census under Caesar Augustus when Quirinius was governor of Syria. However, according to the annals of ancient history, no such census took place.
SOLUTION: Until recently, it has been widely held by critics that Luke made an error in his assertion about a registration under Caesar Augustus, and that the census actually took place in a.d. 6 or 7, (that is mentioned by Luke in Gamaliel’s speech recorded in Acts 5:37). The lack of any extra-biblical support has led some to claim this is an error. However, recent scholarship has reversed this trend, and it is now widely admitted that there was in fact an earlier registration as Luke records. This has been asserted on the basis of several factors.
First of all, since the people of a subjugated land were compelled to take an oath of allegiance to the emperor, it was not unusual for the emperor to require an imperial census as an expression of this allegiance and as a means of enlisting men for military service, or, as was probably true in this case, in preparation to levy taxes. Because of the strained relations between Herod and Augustus in the later years of Herod’s reign, as the Jewish historian Josephus reports, it is understandable that Augustus would begin to treat Herod’s domain as a subject land, and consequently would impose such a census to maintain control of Herod and the people.
Second, periodic registrations of this sort took place on a regular basis every 14 years. According to the very papers that recorded the censuses, (see W.M. Ramsay, Was Christ Born in Bethlehem? 1898), there was in fact a census taken in about 8 or 7 b.c. Because of this regular pattern of census taking, any such action would naturally be regarded as a result of the general policy of Augustus, even though a local census may have been instigated by a local governor. Therefore, Luke recognizes the census as stemming from the decree of Augustus.
Third, a census was a massive project which probably took several years to complete. Such a census for the purpose of taxation was begun in Gaul between 10–9 b.c. that took a period of 40 years to complete. It is quite likely that the decree to begin the census, in about 8 or 7 b.c., may not have actually begun in Palestine until some time later. Problems of organization and preparation may have delayed the actual census until 5 b.c. or even later.
Fourth, it was not an unusual requirement that people return to the place of their origin, or to the place where they owned property. A decree of C. Vibius Mazimus in a.d. 104 required all those who were away from their home towns to return there for the purpose of the census. For the Jews, such travel would not have been unusual at all since they were quite used to the annual pilgrimage to Jerusalem. There is simply no reason to suspect Luke’s statement regarding the census at the time of Jesus’ birth. Luke’s account fits the regular pattern of census taking, and its date would not be an unreasonable one. Also, this may have been simply a local census that was taken as a result of the general policy of Augustus. Luke simply provides us with a reliable historical record of an event not otherwise recorded. Since Dr. Luke has proven himself to be a reliable historian in other matters (see Sir William Ramsey, St. Paul the Traveler and Roman Citizen, 1896), there is no reason to doubt him here (see also comments on Luke 2:2).
LUKE 2:2—Why does Luke say the census was during Quirinius’ governorship since Quirinius was not governor until a.d. 6?
PROBLEM: Luke states that the census decreed by Augustus was the first one taken while Quirinius was governor of Syria. However, Quirinius did not become governor of Syria until after the death of Herod in about a.d. 6. Is this an error in Luke’s historical record?
SOLUTION: Luke has not made an error. There are reasonable solutions to this difficulty.
First, Quintilius Varus was governor of Syria from about 7 b.c. to about 4 b.c. Varus was not a trustworthy leader, a fact that was disastrously demonstrated in a.d. 9 when he lost three legions of soldiers in the Teutoburger forest in Germany. To the contrary, Quirinius was a notable military leader who was responsible for squelching the rebellion of the Homonadensians in Asia Minor. When it came time to begin the census, in about 8 or 7 b.c., Augustus entrusted Quirinius with the delicate problem in the volatile area of Palestine, effectively superseding the authority and governorship of Varus by appointing Quirinius to a place of special authority in this matter.
It has also been proposed that Quirinius was governor of Syria on two separate occasions, once while prosecuting the military action against the Homonadensians between 12 and 2 b.c., and later beginning about a.d. 6. A Latin inscription discovered in 1764 has been interpreted to refer to Quirinius as having served as governor of Syria on two occasions.
It is possible that Luke 2:2 reads, “This census took place before Quirinius was governing Syria.” In this case, the Greek word translated “first” (prōtos) is translated as a comparative, “before.” Because of the awkward construction of the sentence, this is not an unlikely reading.
Regardless of which solution is accepted, it is not necessary to conclude that Luke has made an error in recording the historical events surrounding the birth of Jesus. Luke has proven himself to be a reliable historian even in the details. Sir William Ramsey has shown that in making reference to 32 countries, 54 cities, and 9 islands he made no mistakes!
Geisler, Norman L. ; Howe, Thomas A.: When Critics Ask : A Popular Handbook on Bible Difficulties. Wheaton, Ill. : Victor Books, 1992, S. 383
as far as herod not being alive, maybe it was one of his grandsons also named herod. It never says herod the great.