Many people think that the twelve days of Christmas come before Christmas Day and lead up to it, but that is not the case. The period leading up to Christmas is the Advent season, not the Christmas season. It benefits the retail trade if they can get us to start thinking about things in advance, so they sell winter coats in the fall, spring fashions in the winter, bathing suits in the spring, and back-to-school clothes in the summer. They are just being consistent when they sell Easter clothes during Lent or put up Christmas decorations in Advent. So remember this rule of thumb: the mall is decorated for what is coming next, not for what’s happening now.
In the Church, as in the synagogue, the day begins at sunset. Therefore, Christmas begins at sundown on 24 December, which we very appropriately call Christmas Eve.
The Christmas Season, which begins with Christmas Eve, ends on the eve of Epiphany, which is sundown on 5 January. Therefore, Christmas lasts twelve days, and the period from sundown on 24 December to sundown on 5 January is called the Twelve Days of Christmas.
By this reckoning, Epiphany begins on the twelfth night after Christmas, so Epiphany was called Twelfthnight in England.
You can read more information about the church year.