Glich - v0.3.0 Manual
c - The lunisolar Chinese calendar
Home Development v0.3.0 Manual Hics Library c

Calendar Description - Scheme c

The Chinese calendar is a lunisolar calendar with 12 lunar months in a common year and 13 in a leap year. The start of the year occurs just before the Northward/Spring equinox and is tied to the Southern/Winter solstice. Months start on the day of the new moon and have 39 or 30 days.

Use Case

Definition

Record - Default Order
cyclecyearmonthlmonthday clmonth stem branch

The Record consists of five Fields named cycle, cyear, lmonth, month, and day. There are twelve common months in a year numbered 1 to 12. The lmonth field is set to 0 for these months. In a leap year, one of the months will be repeated with the lmonth field set to 1. Each month starts on day 1, the day of the new moon, and will be 29 or 30 days long.

The years cyear are numbered in cycles of 60. The cycle field counts the number of cycles since the year -2636 Gregorian.

The Epoch is set at
ccyclecyearmonthlmonthday
11101
=
gyearmonthday
-2636215
=
jdnday
758326
.

The calculated fields clmonth, stem and branch are used for formatting.

Formats

Branch Names - Lexicons cbrch & animal
ValueNameAbbrev.Animal
1ZiRat
2ChǒuChouOx
3YínYinTiger
4MǎoMaoRabbit
5ChénChenDragon
6SiSnake
7WuHorse
8WèiWeiGoat
9ShēnShenMonkey
10YǒuYouRooster
11XuDog
12HàiHaiPig
Stem Names - Lexicon cstem
ValueNameAbbrev.
1JiǎJia
2Yi
3BǐngBing
4DīngDing
5Wu
6Ji
7GēngGeng
8XīnXin
9RénRen
10GuìGui
Leap Month Names - Lexicon lmon
ValueNameAbbrev.
0MonthMonth
1Leap-monthLeap
First or Second Names - Lexicon fs
ValueNameAbbrev.
0FirstF
1SecondS

The lmonth field only needs to be displayed when there are a leap month pair, for other months it is redundant. The calculated clmonth field is a copy of the lmonth when one of a leap month pair and a null value otherwise.

The formats supplied with this scheme.

Formats - Grammar c
CodeRulePseudo / ExampleNote
cymldtextInput: cycle cyear month lmonth day
Output: cc yy mm fs dd
D, S
78 42 6 f 15
78 42 6 s 15
78 42 7 f 15
cylmdtextInput: cycle cyear clmonth month day
Output: cc yy LM mm dd
78 42 6 15
78 42 Leap 6 15
78 42 7 15
cylmd_stextInput: cycle stem branch clmonth month day
Output: cc Stem-branch, LM mm dd
78 Yǐ-sì 6 15
78 Yǐ-sì, Leap 6 15
78 Yǐ-sì 7 15
fulltextOutput: Cycle: cc, Year: Stem-branch (yy), LeapMon: mm, Day: dd
Cycle: 78, Year: Yǐ-sì (42), Month: 6, Day: 15
Cycle: 78, Year: Yǐ-sì (42), Leap-month: 6, Day: 15
Cycle: 78, Year: Yǐ-sì (42), Month: 7, Day: 15
animaltextOutput: (ccc) yy Year of the Animal mm LeapMon ddd
(78c) 42 Year of the Snake 6 Month 15d
(78c) 42 Year of the Snake 6 Leap-month 15d
(78c) 42 Year of the Snake 7 Month 15d
deftextInput: cycle cyear month lmonth day clmonth stem branch
Output: cc yy mm lm dd clmonth stem branch
H
78 42 6 0 15 2 6
78 42 6 1 15 1 2 6
78 42 7 0 15 2 6
uunitInput: 9c 9y 9m 9lm 9d 9cm 9s 9b
Output: 9c 9y 9m 9lm 9d 9cm 9s 9b
H
78c 42y 6m 0lm 15d 2s 6b
78c 42y 6m 1lm 15d 1cm 2s 6b
78c 42y 7m 0lm 15d 2s 6b
Notes: D = Default, H = Hidden. Example based on jdn# 2460866, 2460896 and 2460925

Script

Default Script
lexicon cstem { name "Chinese Year Stem"; fieldname stem; lang en; pseudo Stem, Stm; tokens { 1, "Jiǎ", "Jia"; 2, "Yǐ", "Yi"; 3, "Bǐng", "Bing"; 4, "Dīng", "Ding"; 5, "Wù", "Wu"; 6, "Jǐ", "Ji"; 7, "Gēng", "Geng"; 8, "Xīn", "Xin"; 9, "Rén", "Ren"; 10, "Guì", "Gui"; } } lexicon cbrch { name "Chinese Year Branch"; fieldname branch; lang en; pseudo branch, brch; tokens { 1, "Zǐ", "Zi"; 2, "Chǒu", "Chou"; 3, "Yín", "Yin"; 4, "Mǎo", "Mao"; 5, "Chén", "Chen"; 6, "Sì", "Si"; 7, "Wǔ", "Wu"; 8, "Wèi", "Wei"; 9, "Shēn", "Shen"; 10, "Yǒu", "You"; 11, "Xū", "Xu"; 12, "Hài", "Hai"; } } lexicon animal { name "Chinese Year Animals"; fieldname branch; lang en; pseudo Animal; tokens { 1, "Rat"; 2, "Ox"; 3, "Tiger"; 4, "Rabbit"; 5, "Dragon"; 6, "Snake"; 7, "Horse"; 8, "Goat"; 9, "Monkey"; 10, "Rooster"; 11, "Dog"; 12, "Pig"; } } lexicon lmon { name "Leap month"; fieldname clmonth; lang en; pseudo LeapMon, LM; tokens { 0, "Month"; 1, "Leap-month", "Leap"; } } lexicon fs { name "First and Second"; fieldname lmonth; lang en; pseudo FirstSecond, FS; tokens { 0, "First", "F"; 1, "Second", "S"; } } grammar c { name "Chinese"; fields cycle cyear month lmonth day; calculated clmonth stem branch; // Record: cycle cyear month lmonth day clmonth stem branch lexicons lmon fs cstem cbrch; alias pseudo { dd day; mm month; lm lmonth; yy year; cc cycle; } alias unit { d day; m month; lm lmonth; y cyear; c cycle; } function calc_to_def { lmonth = @if(clmonth=null, 0, 1); if stem <> null and branch <> null cyear = ((stem - branch) mod 12) * 5 + stem; endif result = this; } function def_to_calc { clmonth = @if(lmonth=0, null, 1); stem = (cyear - 1) mod 10 + 1; branch = (cyear - 1) mod 12 + 1; result = this; } use { calculate def_to_calc; from:text calc_to_def; } // Note, format used in "Calendrical Calculations" format cymld { inout "{cycle}| {cyear}| {month}| {lmonth:fs:a:l}| {day}"; use:in def_to_calc; } format cylmd { inout "{cycle}| {cyear}| {clmonth:lmon:a}| {month}| {day}"; rank cycle cyear month day; use:in calc_to_def; } format cylmd_s { inout "{cycle}| {stem:cstem}|-{branch:cbrch::l}|, {clmonth:lmon:a}| {month}| {day}"; rank cycle month day; separators ",-"; } format full { output "Cycle: {cycle},| Year: {stem:cstem}-{branch:cbrch::l} ({cyear}),| {lmonth:lmon}:| {month},| Day: {day}"; } format pop { output "({cycle}c)| {cyear} Year of the {branch:animal}| {month}| {lmonth:lmon}| {day}d"; } preferred cymld; } scheme c { name "Chinese"; base chinese; grammar c; }

The script is not dependent on any other script at this time

Home Development v0.3.0 Manual Hics Library c

Managed by WebPageLayout Validated by HTML Validator (based on Tidy)

1st July 2024