Print a datetime's distance from now
Project description
Relative To Now
Convert date/time into a string relative to now.
💾 Install
python -m pip install relative-to-now
# or
poetry add relative-to-now
✨ How to Use
Possible input types:
- time.time()
- datetime.date.today()
- datetime.datetime.now()
Optional inputs:
no_errors(Defaults toFalse, set toTrueto return value when there is an error instead of raising)
Output:
Examples:
import datetime
from RelativeToNow import relative_to_now
print(relative_to_now(datetime.datetime.now() + datetime.timedelta(days=1)))
>>> 1 day from now
Precision for datetime.date is days.
import datetime
from RelativeToNow import relative_to_now
print(relative_to_now(datetime.date.today() - datetime.timedelta(days=2)))
>>> 2 days ago
import time
from RelativeToNow import relative_to_now
print(relative_to_now(time.time()))
>>> just now
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
relative_to_now-1.1.0.tar.gz
(15.1 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 relative_to_now-1.1.0.tar.gz.
File metadata
- Download URL: relative_to_now-1.1.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.0 Linux/5.15.0-1030-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3c4a8963a3b823c3d8415a96f75226d617ef378c6d5e6c94cddb9eccdf8820a
|
|
| MD5 |
2aaabe88b59d03a7a7e780b881e17d82
|
|
| BLAKE2b-256 |
fdfb1790f745b5d01d52d4d1864e784ddebf9b25bfb8fd3aebc1261b83f4a793
|
File details
Details for the file relative_to_now-1.1.0-py3-none-any.whl.
File metadata
- Download URL: relative_to_now-1.1.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.0 Linux/5.15.0-1030-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88bd05d363bdd2007ec96edf0e3a8dc5cbbb248ec5d42e7322bc888252d7f6e1
|
|
| MD5 |
40dc4df18c94a45345b47cb65e5c1250
|
|
| BLAKE2b-256 |
02216a2a467c2ef6c3c2e259a9e02cfffb695ac1163659b8ba0e69bb8a9c15ec
|