🗓 Classes and functions with intuitive names for common dates operations
Project description
Date Assistant
Installation
date-assistant is published on PyPI and can be installed from there:
pip install date-assistant
Usage
Get the difference of days, months or years between 2 dates
from date_assistant import DateAssistant
my_birthday_2021 = DateAssistant('2021-07-13')
date_assistant_birthday = '2021-08-18'
my_birthday_2021.days_diff_with(date_assistant_birthday)
# 36
my_birthday_2021.months_diff_with(date_assistant_birthday)
# 1
my_birthday_2021.years_diff_with(date_assistant_birthday)
# 0
Get the amount of years or months started since or until some date
from date_assistant import DateAssistant
last_day_of_2021 = DateAssistant('2021-12-31')
first_day_of_2022 = '2022-01-01'
first_day_of_2023 = '2023-01-01'
date_assistant_birthday = '2021-08-18'
last_day_of_2021.years_started_until(first_day_of_2022)
# 1
last_day_of_2021.years_started_until(first_day_of_2023)
# 2
last_day_of_2021.months_started_until(first_day_of_2022)
# 1
last_day_of_2021.months_started_since(date_assistant_birthday)
# 4
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
date_assistant-0.7.0.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for date_assistant-0.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35387fd3a3727d8a61e57405a2b534f9d7338ed017753ac0c8537dcb54dfc1a3 |
|
MD5 | 3d4525ebfb2abcc3dbd2503da72c7c74 |
|
BLAKE2b-256 | 6ccf4161685513396c0e15ed5d72939dcdebcc7fe04273b5d604633d5922aa31 |