Human Dates
This is a fork of the original package human_dates made by Jonathan Tushman, but currently unmaintained.
The original package, in turn, was based on a Stack Overflow answer, referencing still another sources (check the post).
I came from the Ruby/Rails world and I missed some of my date sugar. And instead of keeping complaining about it, I thought I would do something about it
It offers two sets of functionality:
and foremost it has a nice time_ago_in_words function.
has some natural language for getting to the beginning and end of things
Note I stole much of this from the following StackOverflow post: http://stackoverflow.com/a/1551394/192791
Note: when you do not pass a time into a function it uses datetime.utcnow()
Installation
$ pip install human_dates
time_ago_in_words Usage
from human_dates import time_ago_in_words, beginning_of_day
print time_ago_in_words()
#prints "just now"
print time_ago_in_words(beginning_of_day())
# prints "8 hours ago"
Natural Language Helpers
from human_dates import *
print beginning_of_day()
print beginning_of_hour()
print beginning_of_year()
print end_of_month()
# and so on ....
# you can also pass a datetime to each of these functions
import human_dates
from datetime import datetime
date = datetime.strptime('Feb 13 2008 1:33PM', '%b %d %Y %I:%M%p')
result = human_dates.end_of_month(date)
print result
# 2008-02-29 23:59:59.999999
Alternatives
Delorean: http://delorean.readthedocs.org/en/latest/quickstart.html (<– please look at this before using human_dates. It’s heavyweight for me but might be great for you)
Other Important Time Libraries
DateUtil: http://labix.org/python-dateutil
Metadata
Release files for human-dates2 1.2.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 | Provenance | Actions |
|---|---|---|---|---|
| human-dates2-1.2.0.tar.gz | 5.6 kB | Without provenance | Details for human-dates2-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| human_dates2-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for human_dates2-1.2.0-py3-none-any.whl |
Total release size: 10.9 kB
Release files / human-dates2-1.2.0.tar.gz
| Download URL | human-dates2-1.2.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a1e18935fa1bbda6b029faec23635ba0b7c1adb43e2e50c15a30cf74d2e75be
|
|
BLAKE2b-256 checksum How to use checksums |
5eaa2afe7ab09f82788fa2cb513456da930e83274e96541bf8e32c512f916c13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
|
Release files / human_dates2-1.2.0-py3-none-any.whl
| Download URL | human_dates2-1.2.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c1202a8d16bb5bac2e83adf53d982ccd419d4316c1c92f5a2c3c810c90b9707
|
|
BLAKE2b-256 checksum How to use checksums |
46f54ccefb935fbbdb44361b43985f19ef0efa0f4d17de8b62029c9116797a6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
|
Security for human-dates2 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.