Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Seems like I constantly need some kind of date functions that aren’t found (or aren’t found easily enough anyway) in the standard library or in 3rd party packages that I use regularly. This library attempts to remedy that so I know where to add the functions when I build them and know where to look for them when I need them.

Getting Started

There are no dependancies to install. You just need to:

pip install datefns

or:

git clone git@github.com:ktr/datefns.git
cd datefns
python setup.py install

Once installed, you can iterate through the entire file without using much memory by doing the following:

import datefns, datetime
d1 = datetime.date(2018, 7, 10)
d2 = datetime.date(2018, 12, 31)
we = datefns.week_ending(d1, week_ends_on='Sun')
ds = datefns.date_table(d1, d2)
me = datefns.eomonth(d1, 5) # datetime.date(2018, 12, 31)

ts = datefns.time_table()

datefns.date_table_to_csv(ds, '/path/to/date-file.csv', overwrite=True)
datefns.time_table_to_csv(ts, '/path/to/time-file.csv', overwrite=True)

import sqlite3
conn = sqlite3.connect(':memory:')
datefns.load_date_table(conn, datefns.date_table(start_date=d1, end_date=d2))
datefns.load_time_table(conn, ts)

ds = datefns.date_range(d1, d2, datefns.by_month)

Running Tests

To run tests:

python -m tests.test_datefns

License

The project is licensed under the MIT License - see the LICENSE.md file for details

Metadata

Release files for datefns 0.0.1a8

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

Source distribution (sdist)

Source distribution for datefns 0.0.1a8
File Size Uploaded
datefns-0.0.1a8.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for datefns 0.0.1a8
File Interpreter ABI Platform
datefns-0.0.1a8-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / datefns-0.0.1a8.tar.gz

Download URL datefns-0.0.1a8.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4171632094c89f37bfb5479f6c2f959a0182f4a0a92204633538a5c40ecc1612
BLAKE2b-256 checksum
How to use checksums
155649605704480b8299d57346cc48f30f51025d8e510b83cdb4eccf33491836
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.6

Release files / datefns-0.0.1a8-py3-none-any.whl

Download URL datefns-0.0.1a8-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e93261aeb50a421eee715f09589f4ecf843e34a6e1ddd73e1175bc6999abee50
BLAKE2b-256 checksum
How to use checksums
905926e9fcc216fd500d25757c2818ff8303fd2c3cf7d376c9fb3c39d6214668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.0.1a8 This release

2 release files

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