DateId
| Category | Status' and Links |
|---|---|
| General | |
| CD/CI | |
| PyPI | |
| Github |
Overview
DateId is a Python utility designed to calculate unique integer identifiers for dates and months relative to a configurable base date. This is particularly useful for database indexing, time-series analysis, or any application where a continuous integer representation of time is more efficient than standard date formats.
Key Features
- Day ID Calculation: Compute a unique integer for any given date.
- Month ID Calculation: Compute a unique integer for any given month.
- Flexible Base Date: Set a custom base date (defaults to 2008-01-01).
- Range Generation: Generate sequences of day and month IDs for a specified period.
- Date Conversion: Convert a
DayIDback into a standard date object or string. - Leap Year Support: Built-in utility for leap year verification.
Basic Usage
Initializing DateId
from dateid import DateId
# Initialize with default base date (2008-01-01)
di = DateId()
# Initialize with a custom base date
di_custom = DateId(p_base_date_str="2000-01-01")
Calculating IDs
# Get Day ID for a specific date
day_id = di.calc_day_id(p_target_date_str="2023-12-25")
# Get Month ID for a specific date
month_id = di.calc_month_id(p_target_date_str="2023-12-25")
Converting ID back to Date
# Get date for a specific Day ID
di.specific_date(p_day_id=5838)
print(di.target_date_str) # Output: 20231225
Generating Ranges
# Generate ranges between two dates
days_tbl, months_tbl = di.generate_range("2023-01-01", "2023-01-05")
Metadata
Release files for DateId 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dateid-1.6.0.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dateid-1.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / dateid-1.6.0.tar.gz
| Download URL | dateid-1.6.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
655386ba7f69cfec7a7fb34a11dc2003497ac352f43e3dac4ed40106750a81fc
|
|
BLAKE2b-256 checksum How to use checksums |
9b38aab24c84bd88785b014e7889b4d9a3f909bdf76a9104ad90ab1aad9bc645
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.11 Linux/6.11.0-1018-azure
|
Release files / dateid-1.6.0-py3-none-any.whl
| Download URL | dateid-1.6.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7626e9bb567605662af9a8db3644b97f0e428f9231b311f1ea2e0aa47f6b768
|
|
BLAKE2b-256 checksum How to use checksums |
e44ebe7f915fda67d62327d39bf1b9276edea4aea9e4e39a373773b37d7a1314
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.11 Linux/6.11.0-1018-azure
|