Description
Compute branchIndex as floor(((hour+1) modulo 24)/2), and return its start/end hours and midnight-crossing flag.
Gan-Zhi combines a ten-stem sequence with a twelve-branch sequence into a sixty-position traditional cycle. Cycle indexes, calendar dates and local clock labels are distinct inputs; the correct calendar assignment must be established separately.
Compute branchIndex as floor(((hour+1) modulo 24)/2), and return its start/end hours and midnight-crossing flag.
When to use this tool
Use Shichen Double-Hour Calculator when you need an explicit traditional cycle-index mapping or step calculation.
How to use the tool and how it works
- Enter hour, minute. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Require hour 0-23 and minute 0-59. Compute branchIndex as floor(((hour+1) modulo 24)/2), and return its start/end hours and midnight-crossing flag.1
The Zi two-hour interval spans 23:00 to 01:00; the supplied clock is used without solar-time correction.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| hour | Hour | Required. Safe integer. |
| minute | Minute | Required. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Object containing the calculated members; expand to inspect the fields below. | Required. Object. |
| result.branchIndex | Zero-based branch order: Zi, Chou, Yin, Mao, Chen, Si, Wu, Wei, Shen, You, Xu, Hai. | Calculated result member: number. |
| result.startHour | Start Hour | Calculated result member: number. |
| result.endHour | End Hour | Calculated result member: number. |
| result.crossesMidnight | True for Zi, whose interval begins at 23:00 and ends at 01:00. | Calculated result member: boolean. |
{
"input": {
"hour": 23,
"minute": 30
},
"output": {
"result": {
"branchIndex": 0,
"startHour": 23,
"endHour": 1,
"crossesMidnight": true
}
}
} Limitations and assumptions
- Minutes are validated but do not change the two-hour bin. Local clock input is literal, without timezone, solar-time, calendar, or daylight-saving conversion.
- Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Consult the intended calendrical convention when deriving labels from dates. Keep local time, day boundaries and solar-term rules explicit rather than treating an index calculator as a calendar or predictive model.
References
-
Calculation and input contract: ganzhi/shichen-from-clock — tool.io
-
Heavenly Stems and Earthly Branches — Hong Kong Observatory
Similar or alternative tools
- Hour Heavenly Stem Calculator
Return [2(dayStemIndex modulo 5)+hourBranchIndex] modulo 10.
- Sexagenary Cycle Step Calculator
Find their shared position in the 60-step cycle, add steps modulo 60, and return ordinal and indexes.