Solar → lunarthe moon's month
The Gregorian date is converted to the Chinese lunar calendar with a bundled month-length table (1920–2040), giving the lunar month and day — and the year's Heavenly-Stem & Branch 干支.
A thousand years ago the star-masters drew a life as a house of twelve palaces 十二宮 — Life and Wealth, Career and Spouse, Travel and Fortune — and set the wandering stars into their rooms. 紫微斗數 begins at the Purple Star 紫微, the emperor of the northern sky, and arranges the rest around it. Enter a birth and the chart is cast in real time: the lunar date resolved, the 五行局 derived, and the fourteen major stars placed room by room — the way a fortune-master would draw it on parchment.
Tap any palace to light it — the chart marks its 三方四正 (opposite palace & the two in trine, the classical field of influence) and reads the stars within.
This read is generated from the chart by rule — a diviner would weigh the stars' brightness 廟旺, their combinations, and the moving periods too. It is offered for reflection and delight, not prediction.
The Gregorian date is converted to the Chinese lunar calendar with a bundled month-length table (1920–2040), giving the lunar month and day — and the year's Heavenly-Stem & Branch 干支.
From 寅 count forward by lunar month, then back by the birth hour — the palace you land on is 命宮. Counting the other way fixes 身宮, the Body palace.
The Life Palace's stem-branch gives its 納音 element — Water-2, Wood-3, Metal-4, Earth-5, or Fire-6 — the divisor that sets where the Purple Star begins.
The lunar day divided by the Element Class, adjusted by the classical 起紫微訣, seats 紫微. Its mirror across the 寅–申 axis seats 天府.
The 紫微系 (six) fall back from 紫微 by fixed steps; the 天府系 (eight) run forward from 天府. Twelve palaces are then laid counter-clockwise from 命宮.
The birth-year stem grants four stars their 化祿·權·科·忌 — fortune, power, merit, friction — and the Element Class sets the 大限 decades, their direction by stem-polarity & gender.
A note on honesty, in the spirit of the almanac: the lunar conversion, the twelve palaces, the Five-Element Class, and all fourteen major stars plus 左輔右弼文昌文曲 and the four 四化 are computed faithfully from the classical rules and verified against a known chart. What a full reading adds — the hundred-odd minor stars 雜曜, each star's brightness 廟旺利陷, the flowing yearly & monthly charts — is summarised here, not exhaustively drawn. The lunar year turns at 正月初一 (not 立春); a leap month is read as its base month; the hour uses clock time without longitude correction. Where schools differ (the 庚-year 四化 especially), one common table is used.