A Chinese Calendar Library in Pure Python
Project description
Chinese Calendar: http://en.wikipedia.org/wiki/Chinese_calendar
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).year 1976 >>> LunarDate(1976, 8, 8, 1).month 8 >>> LunarDate(1976, 8, 8, 1).day 8 >>> LunarDate(1976, 8, 8, 1).isLeapMonth True>>> 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-ld datetime.timedelta(0) >>> (ld-sd).days -11444 >>> ld-td LunarDate(1976, 7, 27, 0) >>> (sd-ld).days 11444 >>> ld+td LunarDate(1976, 8, 18, 0) >>> td+ld LunarDate(1976, 8, 18, 0) >>> ld2 = LunarDate.today() >>> ld < ld2 True >>> ld <= ld2 True >>> ld > ld2 False >>> ld >= ld2 False >>> ld == ld2 False >>> ld != ld2 True >>> ld == ld True >>> LunarDate.today() == LunarDate.today() True >>> before_leap_month = LunarDate.fromSolarDate(2088, 5, 17) >>> before_leap_month.year 2088 >>> before_leap_month.month 4 >>> before_leap_month.day 27 >>> before_leap_month.isLeapMonth False >>> leap_month = LunarDate.fromSolarDate(2088, 6, 17) >>> leap_month.year 2088 >>> leap_month.month 4 >>> leap_month.day 28 >>> leap_month.isLeapMonth True >>> after_leap_month = LunarDate.fromSolarDate(2088, 7, 17) >>> after_leap_month.year 2088 >>> after_leap_month.month 5 >>> after_leap_month.day 29 >>> after_leap_month.isLeapMonth False
Limits
this library can only deal with year from 1900 to 2099 (in chinese calendar).
See also
lunar: http://packages.qa.debian.org/l/lunar.html, A converter written in C, this program is derived from it.
python-lunar: http://code.google.com/p/liblunar/ Another library written in C, including a python binding.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lunardate-0.2.0.tar.gz.
File metadata
- Download URL: lunardate-0.2.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c9c96d9f01522a10ab35df1a9b48707ae64a086f13fd34498b43f465918cc6f
|
|
| MD5 |
ea6a1558ead36a2c0e51d6715dc784c0
|
|
| BLAKE2b-256 |
d7ce571488ce9f7c79f8e1e0e4269b72e32c990547d41c5c77ee81dc069795db
|
File details
Details for the file lunardate-0.2.0-py3.7.egg.
File metadata
- Download URL: lunardate-0.2.0-py3.7.egg
- Upload date:
- Size: 10.2 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd7d7c7a61dbb843662eb8b04da2f0c8bb1e9e2c1dd8acced6ebcb21151eb19c
|
|
| MD5 |
3a6da849529994fa551203e96b13f06b
|
|
| BLAKE2b-256 |
69cbe4a311a849c25d74df2198061cf161f6d5125523fd685e55a9231fca6053
|
File details
Details for the file lunardate-0.2.0-py3-none-any.whl.
File metadata
- Download URL: lunardate-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5619d625809ebcaa673c4e321cd1ea82e649e9bb47e42e6479fe15bbc2b5bffe
|
|
| MD5 |
bd22afe3cda41f519e235b1d301a2eda
|
|
| BLAKE2b-256 |
4e7e377a3cbba646ec0cf79433ef858881d809a3b87eb887b0901cb83c66a758
|
File details
Details for the file lunardate-0.2.0-py2.7.egg.
File metadata
- Download URL: lunardate-0.2.0-py2.7.egg
- Upload date:
- Size: 10.1 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0bb5938d7c7f363a26f599a3c27b7f5560edd8b689ef3c5865ec401dfc7ed88
|
|
| MD5 |
12135c6986c70b0de80e250e94010b5e
|
|
| BLAKE2b-256 |
0a3d4e044d104a59dbde228bec1a75243ff121d4388e2f0606c11248572f6a9c
|
File details
Details for the file lunardate-0.2.0-py2-none-any.whl.
File metadata
- Download URL: lunardate-0.2.0-py2-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
838e84b95d185a12f8bd0c5bdd74864be52d55436bed56927fdc91f4d21ad6b6
|
|
| MD5 |
cc989e4bfc360f467a0621c43a0bbf25
|
|
| BLAKE2b-256 |
c6d8f382ddbf8af5026d22815cb3b7e706240c9aa056a1f1815a51754cfab365
|