A Quick Method for Calculating the Day Pillar from the Gregorian Calendar
First published on the WeChat public account "Daoist Yinfu Culture." 2019-10-11. Illustrations omitted.
The arts of calculation often require the stem-branch calendar. Nowadays people generally use phones to draw charts or look things up online, but sometimes when no charting software is at hand, or when the date falls outside what the software can compute, calculating the stems and branches becomes rather troublesome.
Years and months are always easier to remember; for most people, the hardest part is the method for calculating the day pillar.
Rapid calculation can use the famous Gao day-pillar formula. To compute the stems and branches with it, an auxiliary formula is also needed:
Auxiliary formula: X = 44 (C−17) + (C−17)/4 + 3
Day-pillar formula: r = s/4 × 6 + 5(s/4 × 3 + u) + m + d + x
r: the mother number of the day pillar; the remainder of r divided by 60 is the stem-branch sequence number of the day pillar.
s: the last two digits of the CE year; s/4 takes only the integer part.
u: the remainder of s divided by 4.
m: the month base number.
d: the day number.
x: the century constant.
s: the last two digits of the CE year; s/4 takes only the integer part.
u: the remainder of s divided by 4.
m: the month base number.
d: the day number.
x: the century constant.
For example, to calculate the day pillar of October 1, 1949: first calculate X. 1949 is in the 20th century, so C = 20.
X = 44(20−17) + (20−17)/4 + 3
X = 135
X = 135
Taking the resulting x modulo 60 gives 15. Substitute into the day-pillar formula:
r = s/4 × 6 + 5(s/4 × 3 + u) + m + d + 15
For the year '49, s is taken as minus 1, so s is 48. And m is the month base number, which requires looking up the table:
Since it is October 1, m is 33 and d is 1, so we can substitute:
r = 49/4 × 6 + 5(49/4 × 3 + u) + 33 + 1 + 15
Note u — it is the remainder of 48 divided by 4, so u = 0. Therefore:
r = 48/4 × 6 + 5(48/4 × 3 + 0) + 33 + 1 + 15
r = 72 + 180 + 33 + 1 + 15
r = 301
r = 72 + 180 + 33 + 1 + 15
r = 301
Finally we get r = 301. Taking the remainder modulo 60 gives 1, and 1 is Jiazi — so October 1, 1949 was a Jiazi day.
Similarly, to calculate the day pillar of January 1, 2000: for the 21st century, naturally C = 21, so:
X = 44(21−17) + (21−17)/4 + 3
X = 176 + 1 + 3
X = 180
X = 176 + 1 + 3
X = 180
Modulo 60 gives 0, so x = 0. And for the year 2000, taking the last two digits 00 and subtracting 1 gives 99. Substitute into the day-pillar formula:
r = s/4 × 6 + 5*(s/4 × 3 + u) + m + d
r = 99/4 × 6 + 5*(99/4 × 3 + 3) + 0 + 1
r = 24*6 + 5*(26*3 + 3) + 1
r = 148.5 + 386.25 + 1
r = 535.75
r = 99/4 × 6 + 5*(99/4 × 3 + 3) + 0 + 1
r = 24*6 + 5*(26*3 + 3) + 1
r = 148.5 + 386.25 + 1
r = 535.75
Taking the integer part gives 535; modulo 60 gives 55 — the fifty-fifth position in the stem-branch list: Wuwu. So the day pillar of January 1, 2000 is Wuwu.
This kind of calculation also requires memorizing the month base-number table, and s must be converted by subtracting 1, while u represents taking a remainder — genuinely cumbersome. Is there a method that seems to impose less mental burden?
The answer is yes. On Wikipedia there is a formula that goes like this:
r = 44*c + INT(c/4) + 5*y + INT(y/4) + 30*(m+1) + INT(3*(m+1)/5) + d + 7;
The calculation here is simpler. INT means that the operation inside the parentheses takes only the integer part, ignoring the decimal. For example, for October 11, 2019, the variables are:
c = 20
y = 19
m = 10
d = 11
y = 19
m = 10
d = 11
Then simply substitute and compute. In particular, this formula need not involve decimal arithmetic — wherever the division is not exact, the decimals can simply be ignored. For example, substituting these variables, the formula becomes:
r = 44*20 + INT(20/4) + 5*19 + INT(19/4) + 30*(10+1) + INT(3*(10+1)/5) + 11 + 7;
r = 880 + 5 + 95 + 4 + 330 + 6 + 11 + 7
r = 1338
r = 880 + 5 + 95 + 4 + 330 + 6 + 11 + 7
r = 1338
1338 modulo 60 gives 18 — the 18th stem-branch.
18 modulo 10 gives 8 — the heavenly-stem sequence number; the eighth is Xin.
18 modulo 12 gives 6 — the earthly-branch sequence number; the sixth is Si.
18 modulo 12 gives 6 — the earthly-branch sequence number; the sixth is Si.
So this day pillar is Xinsi.
But note: this formula is only suitable for the Gregorian calendar after 1582. For the Julian calendar before 1582, the coefficient of C must be changed to 45, and the final +7 changed to +5.
For clarity, listed separately:
Gregorian: r = 44*c + INT(c/4) + 5*y + INT(y/4) + 30*(m+1) + INT(3*(m+1)/5) + d + 7;
Julian: r = 45*c + INT(c/4) + 5*y + INT(y/4) + 30*(m+1) + INT(3*(m+1)/5) + d + 5;
Julian: r = 45*c + INT(c/4) + 5*y + INT(y/4) + 30*(m+1) + INT(3*(m+1)/5) + d + 5;