datetime-parser
datetime can be many different formats and often we want to express a time relative
to the current time, such as 10 minutes ago. This module is able to handle all datetime formats
as well as our custom relative time format.
Relative datetime format:
For the current time:
now
Any other time:
(+/-)(integer) (milliseconds|seconds|minutes|days|weeks|months|years)
examples:
now
-1 months
+3 days
-123 seconds
Parse Datetime
To parse a datetime (not including relative time), you can use the try_parse_dt function. This
will return a pendulum object
from datetime_parser import try_parse_dt
example = "2020-02-02 10:10:10"
example_obj = try_parse_datetime(example)
Parse Relavite Time
To parse a datetime or relative datetime, use is_datetime.
from datetime_parser import is_datetime
example = "-5 minutes"
example_obj = is_datetime(example)
Metadata
Release files for datetime-parser 1.1.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 | |
|---|---|---|---|
| datetime-parser-1.1.0.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datetime_parser-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.8 kB
Release files / datetime-parser-1.1.0.tar.gz
| Download URL | datetime-parser-1.1.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0e08565f4832ca67b3ab01c0f834f8acc65b85b71a288773848c04ff83035e7
|
|
BLAKE2b-256 checksum How to use checksums |
90a154e942c89ad39a82a6ddc36181d045a3e98e3507e7aac8f5898e1a84ac2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.19 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15
|
Release files / datetime_parser-1.1.0-py3-none-any.whl
| Download URL | datetime_parser-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8c06ec53e7ae5f69508ef04ff3a20f3d6e6b52095df2f6e32d78b5232e174d0
|
|
BLAKE2b-256 checksum How to use checksums |
6004ee12476c7acc60fb1f83eb2e63e33a44963526e7f4d675650e37b94e6dc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.19 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15
|