Skip to main content

Python calendar helper.

Project description

calendary

https://img.shields.io/pypi/v/calendary.svg https://travis-ci.org/DavidHickman/calendary.svg?branch=master Documentation Status Updates Python 3

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.

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

calendary-0.3.13.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

calendary-0.3.13-py2.py3-none-any.whl (5.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file calendary-0.3.13.tar.gz.

File metadata

  • Download URL: calendary-0.3.13.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for calendary-0.3.13.tar.gz
Algorithm Hash digest
SHA256 6abc030c08f37e3f8fdb3aebcf45759419ed44994d322e2648f17f8ae98812a6
MD5 4e843850a8acf4c3031e20d873c458e7
BLAKE2b-256 d1c379e710b14cfeeaaa44f4cd527caa9822fd6d162da7a94a9de48e14be1e65

See more details on using hashes here.

File details

Details for the file calendary-0.3.13-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for calendary-0.3.13-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 05251c5970d5b0e5342df2687d8be8fd8a7c5d2a431fac7515ce6a27845fc4b2
MD5 8c49f863bc2cd44e0f3ae9e55f76e702
BLAKE2b-256 23bd1022c1ce304d0527441bbc1ea3c85f95bc6d7d319b687ce2b3221335d9e3

See more details on using hashes here.

Supported by

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