有较多需求需要查看农历,
可以从月相中大体推断, 日历中调用M
Wednesday, July 3, 2019: New Moon 3:17am (CST)
Tuesday, July 9, 2019: First Quarter Moon 6:57pm (CST)
Wednesday, July 17, 2019: Full Moon 5:35am (CST)
Thursday, July 25, 2019: Last Quarter Moon 9:25am (CST)
Thursday, August 1, 2019: New Moon 11:13am (CST)
满月是07-17, 今天07-15, 十五 减去 二 等于 十三, 大体推断是农历十三.
但这往往会有正负三两天的误差, 中国农历历经明末与清初的改进之后, 不再以阴历(月亮历)而是以阳历(太阳历)为基础.
在diary中添加一行
;;Day infos
%%(diary-chinese-date)
Agenda中便能查看农历.
碰巧今天是十三.
可以用 cal-china-x 这个 package
2 个赞
这里的cycle 78 year 36 是什么意思?
year 36是天干地支纪年, 60一甲子, 36/60. 不知道78是代表什么.
不过这样算的话,第78个周期的第36年是77 * 60 + 36 = 4656年,实际上今年是 4717 年,这样计算错在哪里了?想不明白。
一个参考
可能就是4717/60=78.6取小数前算的
(defun calendar-chinese-from-absolute (date)
"Compute Chinese date (cycle year month day) corresponding to absolute DATE.
The absolute date is the number of days elapsed since the (imaginary)
Gregorian date Sunday, December 31, 1 BC."
(let* ((g-year (calendar-extract-year
(calendar-gregorian-from-absolute date)))
(c-year (+ g-year 2695))
(list (append (calendar-chinese-year (1- g-year))
(calendar-chinese-year g-year)
(calendar-chinese-year (1+ g-year)))))
(while (<= (cadr (cadr list)) date)
;; The first month on the list is in Chinese year c-year.
;; Date is on or after start of second month on list...
(if (= 1 (caar (cdr list)))
;; Second month on list is a new Chinese year...
(setq c-year (1+ c-year)))
;; ...so first month on list is of no interest.
(setq list (cdr list)))
(list (/ (1- c-year) 60)
;; Remainder of c-year/60 with 60 instead of 0.
(1+ (mod (1- c-year) 60))
(caar list)
(1+ (- date (cadr (car list)))))))
看了代码,确实是这样
1 个赞