Skip to main content

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.

Metadata

Release files for calendary 0.3.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for calendary 0.3.13
File Size Uploaded
calendary-0.3.13.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for calendary 0.3.13
File Interpreter ABI Platform
calendary-0.3.13-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 20.4 kB

Release files / calendary-0.3.13.tar.gz

Download URL calendary-0.3.13.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6abc030c08f37e3f8fdb3aebcf45759419ed44994d322e2648f17f8ae98812a6
BLAKE2b-256 checksum
How to use checksums
d1c379e710b14cfeeaaa44f4cd527caa9822fd6d162da7a94a9de48e14be1e65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / calendary-0.3.13-py2.py3-none-any.whl

Download URL calendary-0.3.13-py2.py3-none-any.whl
Size 5.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
05251c5970d5b0e5342df2687d8be8fd8a7c5d2a431fac7515ce6a27845fc4b2
BLAKE2b-256 checksum
How to use checksums
23bd1022c1ce304d0527441bbc1ea3c85f95bc6d7d319b687ce2b3221335d9e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.13 This release

2 release files

0.3.11

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page