Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Python calendar helper.

Project Description

calendary

Python calendar and datetime helpers.

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.
Release History

Release History

History Node

0.3.13

History Node

0.3.11

History Node

0.3.8

History Node

0.3.7

History Node

0.3.5

History Node

0.3.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

This version
History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.14

History Node

0.1.13

History Node

0.1.12

History Node

0.1.11

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
calendary-0.2.3-py2.py3-none-any.whl (5.4 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Jul 25, 2016
calendary-0.2.3.tar.gz (14.5 kB) Copy SHA256 Checksum SHA256 Source Jul 25, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting