if (span_days <49):
year = START_YEAR - 1
if (span_days <19):
month = 11;
day = 11 + span_days
else:
month = 12;
day = span_days - 18
return (year, month, day)
#下面从阴历1901年正月初一算起
span_days -= 49
year, month, day = START_YEAR, 1, 1
#计算年
tmp = lunar_year_days(year)
while span_days >= tmp:
span_days -= tmp
year += 1
tmp = lunar_year_days(year)
#计算月
(foo, tmp) = lunar_month_days(year, month)
while span_days >= tmp:
span_days -= tmp
if (month == get_leap_month(year)):
(tmp, foo) = lunar_month_days(year, month)
if (span_days < tmp):
return (0, 0, 0)
span_days -= tmp
month += 1
(foo, tmp) = lunar_month_days(year, month)
#计算日
day += span_days
return (year, month, day)
#功能简单,只打印当月的
this_month()