Skip to main content

No project description provided

Project description

Python Application

python-calendar

Install

From PyPI

pip install python-calendar

From source

rm build/ python_calendar.egg-info dist -Rf
python3 setup.py bdist_wheel
pip3 install -I dist/python_calendar-*-py3-none-any.whl

How to use

from python_calendar import Calendar
from dateutil.parser import parse

date_from = parse('2023-08-23')
date_to = parse('2024-08-23')
calendar = Calendar.get(date_from, date_to)

'Nb days : %s' % len(calendar.days) 
#Nb days : 366

'Nb weeks : %s' % len(calendar.weeks) 
#Nb weeks : 53

'Nb days for the 18th week in 2024 : %s' % len(calendar.nodes['2024-W18'].days) 
#Nb days for the 18th week in 2024 : 7

'Nb months : %s' % len(calendar.months) 
#Nb months : 13

'Nb days for Feb 2024 : %s' % len(calendar.nodes['2024-02'].days) 
#Nb days for Feb 2024 : 29

'Nb years : %s' % len(calendar.years) 
#Nb years : 2

'Nb days in 2024 : %s' % len(calendar.nodes['2024'].days) 
#Nb days in 2024 : 235

calendar.days[0]
# 2023-08-23

calendar.days[-1]
# 2024-08-22

for d in calendar.nodes['2024-W34'].days:
    print(d.date)
# 2024-08-19 00:00:00
# 2024-08-20 00:00:00
# 2024-08-21 00:00:00
# 2024-08-22 00:00:00

Contributors

Anthony K GROSS

Copyright and license

Code and documentation copyright 2024. Code released under the MIT license.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

python_calendar-1.0.1-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

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