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")
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dateid-1.6.0.tar.gz
(5.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dateid-1.6.0.tar.gz.
File metadata
- Download URL: dateid-1.6.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.2.1 CPython/3.13.11 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
655386ba7f69cfec7a7fb34a11dc2003497ac352f43e3dac4ed40106750a81fc
|
|
| MD5 |
6695f687933379efd58841567d9459fd
|
|
| BLAKE2b-256 |
9b38aab24c84bd88785b014e7889b4d9a3f909bdf76a9104ad90ab1aad9bc645
|
File details
Details for the file dateid-1.6.0-py3-none-any.whl.
File metadata
- Download URL: dateid-1.6.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.2.1 CPython/3.13.11 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7626e9bb567605662af9a8db3644b97f0e428f9231b311f1ea2e0aa47f6b768
|
|
| MD5 |
b2e042639b226c9cc84b3dda4297c223
|
|
| BLAKE2b-256 |
e44ebe7f915fda67d62327d39bf1b9276edea4aea9e4e39a373773b37d7a1314
|