hotdate 
hotdate is a library for doing friendly date formating. Its API is inspired by Moment.js.
hotdate wraps Python’s builtin datetime object with a layer that simplifies some common operations that are annoying to do with datetime. More importantly, hotdate provides functionality for doing friendly/human-readable relative date formatting. It even has one of those crazy “fluent interfaces” that are so hip with the kids these days.
A quick tour
Construction
You can create hotdate objects in a bunch of ways.
from hotdate import hotdate
# get the current time and date
>>> hotdate()
hotdate(2014, 3, 4, 21, 34, 3, 661600)
>>> hotdate(2011)
hotdate(2011, 1, 1, 0, 0)
>>> hotdate('2012 03', '%Y %m')
hotdate(2012, 3, 1, 0, 0)
>>> d = datetime.datetime.now()
>>> hotdate(d)
hotdate(2014, 3, 4, 21, 34, 3, 661600)
Formatting
You can use it to format dates:
>>> hotdate().format()
'2014-03-04T21:46:18'
>>> hotdate().format('%c')
'Tue Mar 4 21:47:03 2014'
“How long ago?”
>>> hotdate().from_now()
'just now'
>>> hotdate(2011).from_now()
'2 years ago'
>>> hotdate().add(minutes=30).from_now()
'29 minutes from now'
Calendar date formatting
>>> hotdate().calendar()
'Today at 09:50PM'
>>> hotdate().add(days=1).calendar()
'Tomorrow at 09:51PM'
>>> hotdate().subtract(days=4).calendar()
'Last Friday at 09:51PM'
>>> hotdate(2011).calendar()
'1/1/2011'
Use it just like a datetime
>>> hotdate().isoformat()
'2014-03-05T17:00:28.699772'
>>> hotdate.fromtimestamp(1311218002)
hotdate(2011, 7, 20, 23, 13, 22)
>>> hotdate().timetuple()
time.struct_time(tm_year=2014, tm_mon=3, tm_mday=5, tm_hour=17, tm_min=10, tm_sec=35, tm_wday=2, tm_yday=64, tm_isdst=-1)
Metadata
Release files for hotdate 0.4.5
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 |
|---|---|---|---|---|
| hotdate-0.4.5.tar.gz | 5.0 kB | Without provenance | Details for hotdate-0.4.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hotdate-0.4.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for hotdate-0.4.5-py2.py3-none-any.whl |
Total release size: 11.6 kB
Release files / hotdate-0.4.5.tar.gz
| Download URL | hotdate-0.4.5.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6205b429060dba316ce178732fb0e28c1166e15215f3c529a1c25465dacfebe3
|
|
BLAKE2b-256 checksum How to use checksums |
901abdf72fa58d5453d952b590a963ba18e178f2f66bd56e1abc046cc1d96ca6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / hotdate-0.4.5-py2.py3-none-any.whl
| Download URL | hotdate-0.4.5-py2.py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a9c0c5dc4b1bce73b04205e2e20e23ea61f08fefec3e3944eb97c677d33ce9ad
|
|
BLAKE2b-256 checksum How to use checksums |
59a3dfe5d1e838208d71c4009306dbd704e05b29ca434901c7d13c6487d6cdc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for hotdate 0.4.5
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.