M
M
MaxxZ2020-05-16 17:56:54
Python
MaxxZ, 2020-05-16 17:56:54

How to calculate Chinese New Year date in Python?

What about Orthodox or Catholic Easter?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MaxxxZ, 2020-05-16
@MaxxxZ

Managed to find.
pip install LunarCalendar

import datetime
from lunarcalendar import Converter, Solar, Lunar, DateNotExist

l = Lunar(year=2020, month=1, day=1, isleap=False)
print(Converter.Lunar2Solar(l))

will give out absolutely correct 01/25/2020

A
alternativshik, 2020-05-16
@alternativshik

Just like without python.

S
szafranji, 2020-05-16
@szafranji

"Chinese New Year begins on the 1st day of the 1st month of the Chinese lunisolar calendar."
I don’t know if this will tell you something) Look on the Internet for tables of the onset of the new year in different years, maybe you will find a pattern. And then it will be possible to write your own algorithm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question