Python calendar helper.
Project description
calendary
Python calendar and datetime helpers.
Free software: BSD license
Documentation: https://calendary.readthedocs.io.
Features
Return a list of days for any year
cal = Calendary(2016)
weekdays = cal.weekday_calendar()
today = datetime.datetime.now().date()
for weekday, date in weekdays:
if date < today:
print("{0}-{1}-{2} was a {3}".format(date.month, date.day, date.year, weekday))
elif date == today:
print("Today is {}".format(weekday))
else:
print("{0}-{1}-{2} will be a {3}".format(date.month, date.day, date.year, weekday))
Return a list of only workdays (default: Monday-Friday)
cal = Calendary(2016)
workdays = cal.workday_calendar()
for weekday, date in workdays:
print(weekday, date)
Change the workweek begin and end
cal = Calendary(2016)
# Work Tuesday - Saturday
workdays = cal.workday_calendar(workweek_start=1, workweek_end=5)
Get the calendar for a specific month
cal = Calendary(2016)
# July calendar
cal.month(7)
# July workweek calendar
cal.month(7, work=True, workweek_start=1, workweek_end=5)
Get a specific date relative to the calendar
cal = Calendary(2016)
# Get the third Thursday in July of 2016
cal.weekday('Thursday', month=7, ordinal=3)
# Get all Thursdays in July 2016
cal.weekday('Thursday', month=7)
# Get the third Thursday in 2016
cal.weekday('Thursday', ordinal=3)
# Get all Thursdays in 2016
cal.weekday('Thursday')
# Get all Mondays and Thursdays in July, 2016 using weekday index values
cal.weekday((0, 3), month=7)
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2016-07-20)
First release on PyPI.
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
calendary-0.3.3.tar.gz
(14.7 kB
view hashes)
Built Distribution
Close
Hashes for calendary-0.3.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a4d06b82724f4fe9e8fb3a6e37a2b8efdfea0e43d57d4b4aee7bc9584c5f889 |
|
MD5 | 28229b42ca14e52edf365442b3bae3a9 |
|
BLAKE2b-256 | 055f439919a776b865787816360fb81848d8a3250bae74eabc9084e7108203b9 |