Skip to main content

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
datetime.timedelta(-11444)
>>> ld-td
LunarDate(1976, 7, 27, 0)
>>> sd-ld
datetime.timedelta(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

Limits

this library can only deal with year from 1900 to 2049 (in chinese calendar).

See also

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lunardate-0.1.5.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lunardate-0.1.5-py2.7.egg (9.2 kB view details)

Uploaded Egg

File details

Details for the file lunardate-0.1.5.tar.gz.

File metadata

  • Download URL: lunardate-0.1.5.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lunardate-0.1.5.tar.gz
Algorithm Hash digest
SHA256 975425599f66248ed1c4df2fcd74db00398fa112c9aaed032e369f43666cfd1a
MD5 7a7ca79f68ccea1d0981286ef9af1cc5
BLAKE2b-256 5edda26536c83801cb276d2288a3a973fea8b8cf3e9037420955946ef633dafc

See more details on using hashes here.

File details

Details for the file lunardate-0.1.5-py2.7.egg.

File metadata

  • Download URL: lunardate-0.1.5-py2.7.egg
  • Upload date:
  • Size: 9.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lunardate-0.1.5-py2.7.egg
Algorithm Hash digest
SHA256 e303d5defc6fa5509536b340fc6f61b3588d7857991288a449bd4e0cacd42d53
MD5 f14653acc62f1540a83a13e554fc86f2
BLAKE2b-256 496dafc63be882b1d59aa05ce85fae5135fe0bd7794e777f71fbe962b1638d50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page