lunardateA Chinese Calendar Library | |
Download |
lunardate Ranking & Summary
Advertisement
- License:
- GPL v3
- Price:
- FREE
- Publisher Name:
- LI Daobing
- Publisher web site:
- http://code.google.com/u/lidaobing/
lunardate Tags
lunardate Description
A Chinese Calendar Library lunardate is a Chinese calendar library written in pure Python.Usage:>>> LunarDate.fromSolarDate(1976, 10, 1)LunarDate(1976, 8, 8, 1)>>> LunarDate(1976, 8, 8, 1).toSolarDate()datetime.date(1976, 10, 1)>>> LunarDate(1976, 8, 8, 1).year1976>>> LunarDate(1976, 8, 8, 1).month8>>> LunarDate(1976, 8, 8, 1).day8>>> LunarDate(1976, 8, 8, 1).isLeapMonthTrue>>> today = LunarDate.today()>>> type(today).__name__'LunarDate'>>> # support '+' and '-' between datetime.date and datetime.timedelta>>> ld = LunarDate(1976,8,8)>>> sd = datetime.date(2008,1,1)>>> td = datetime.timedelta(days=10)>>> ld-lddatetime.timedelta(0)>>> ld-sddatetime.timedelta(-11444)>>> ld-tdLunarDate(1976, 7, 27, 0)>>> sd-lddatetime.timedelta(11444)>>> ld+tdLunarDate(1976, 8, 18, 0)>>> td+ldLunarDate(1976, 8, 18, 0)>>> ld2 = LunarDate.today()>>> ld < ld2True>>> ld >> ld > ld2False>>> ld >= ld2False>>> ld == ld2False>>> ld != ld2True>>> ld == ldTrue Requirements: · Python Limitations: · This library can only deal with year from 1900 to 2049 (in chinese calendar). What's New in This Release: · support '+', '-' and compare, fix bug in year 2050
lunardate Related Software