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 details)

Uploaded Python 3

File details

Details for the file python_calendar-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for python_calendar-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 21deaea0bd0fc5def6f330209e0277fe9dbac32941ebe48ec069af4ffa15779d
MD5 2e39b979557b0fa80a12141f54bc7173
BLAKE2b-256 f526d0e637df9774a5a7d44ffbedef38fcd88f1bc38d4f553637a52e77c4b53e

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