Short answer. It turns on a 180-day count from the second wedding. A child born before 180 days after the subsequent marriage is considered conceived during the former one, provided the birth falls within 300 days of its termination. A child born after that mark is considered conceived during the second marriage.
What the law says
A child born before one hundred eighty days after the solemnization of the subsequent marriage is considered to have been conceived during the former marriage, provided it be born within three hundred days after the termination of the former marriage
Family Code, Article 168 — Presumptions When a Mother Remarries Quickly. Read the full provision →
What the law says
these rules shall govern in the absence of proof to the contrary
Family Code, Article 168 — Presumptions When a Mother Remarries Quickly. Read the full provision →
The rules only switch on in a narrow window
Before the counting begins, check whether the article applies at all. It is written for the case where the first marriage is terminated and the mother contracts another marriage within three hundred days after that termination. If the second wedding came later than that, this provision has nothing to say and the ordinary rules about children conceived or born during a marriage do the work instead. So the first two dates to establish are not the birth and the wedding but the end of the first marriage and the start of the second, and the gap between them.
Working the two counts
Take the date of the subsequent marriage and count 180 days forward. A child born before that point is considered to have been conceived during the former marriage — but only on a condition: the birth must fall within 300 days after the former marriage ended. Both parts have to be satisfied, and a birth that clears the first test while failing the second is not covered by that rule. A child born after the 180-day mark is considered conceived during the subsequent marriage, and the article says so even where the birth still falls inside the 300 days after the first marriage's termination. The later marriage prevails in that overlap.
These are presumptions, and they can be displaced
The whole article is expressly prefaced with the words in the absence of proof to the contrary. That phrase is doing more than politeness. The counts are a default the law applies when nobody has established anything better; they are not findings of fact and they are not conclusive. Where actual evidence about conception exists, the presumption gives way to it. What the article really provides is a rule for the ordinary case, so that a child born in this overlap has a settled position from the start rather than an open question that has to be litigated before anything else can happen.
What the presumption decides, and what it does not
Read closely, the article assigns the child to a marriage, not to a man by name. It answers which marriage the child is presumed to have been conceived in, and the consequences for status and paternity follow from that assignment through the Code's other provisions on legitimacy. Nor does it settle anything about who may challenge the result, or how long they have to do it — those limits sit elsewhere and they are short. If you are in this situation, the documents that resolve it are the record terminating the first marriage, the certificate of the second, and the birth certificate, with all three dates read together.