relative-to-now


Namerelative-to-now JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/Riverside-Healthcare/RelativeToNow
SummaryPrint a datetime's distance from now
upload_time2023-01-16 16:00:41
maintainerChristopher Pickering
docs_urlNone
authorChristopher Pickering
requires_python>=3.7.2,<4.0.0
licenseGPL-3.0-or-later
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            
<h1 align="center">Relative To Now</h1>

<h4 align="center">Convert date/time into a string relative to now.</h4>

<p align="center">
  <a href="https://pypi.org/project/relative-to-now/">
    <img src="https://img.shields.io/badge/Python-3.7%20%7C%203.8%20%7C%203.9-blue" alt="Python Version">
  </a>
  <a href="https://codecov.io/gh/Riverside-Healthcare/RelativeToNow">
    <img src="https://codecov.io/gh/Riverside-Healthcare/RelativeToNow/branch/master/graph/badge.svg?token=PHYGI9FI22" alt="Codecov Status">
  </a>
  <a href="https://www.codacy.com/gh/Riverside-Healthcare/RelativeToNow/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Riverside-Healthcare/RelativeToNow&amp;utm_campaign=Badge_Grade">
    <img src="https://app.codacy.com/project/badge/Grade/2533c8838ffe4c6a82c889d6d98f2050" alt="Codacy Status">
  </a>
  <a href="https://pypi.org/project/relative-to-now/">
    <img src="https://badgen.net/pypi/v/relative-to-now" alt="Pypi Download">
  </a>
  <a href="https://pepy.tech/project/relative-to-now">
    <img src="https://static.pepy.tech/badge/relative-to-now" alt="Downloads">
  </a>
</p>


## 💾 Install

```sh
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 to ``False``, set to ``True`` to return value when there is an error instead of raising)

Output:
    <int> <unit> <text>

Examples:
```python
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.
```python
import datetime
from RelativeToNow import relative_to_now

print(relative_to_now(datetime.date.today() - datetime.timedelta(days=2)))
>>> 2 days ago
```

```python
import time
from RelativeToNow import relative_to_now

print(relative_to_now(time.time()))
>>> just now
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Riverside-Healthcare/RelativeToNow",
    "name": "relative-to-now",
    "maintainer": "Christopher Pickering",
    "docs_url": null,
    "requires_python": ">=3.7.2,<4.0.0",
    "maintainer_email": "cpickering@rhc.net",
    "keywords": "",
    "author": "Christopher Pickering",
    "author_email": "cpickering@rhc.net",
    "download_url": "https://files.pythonhosted.org/packages/fd/fb/1790f745b5d01d52d4d1864e784ddebf9b25bfb8fd3aebc1261b83f4a793/relative_to_now-1.1.0.tar.gz",
    "platform": null,
    "description": "\n<h1 align=\"center\">Relative To Now</h1>\n\n<h4 align=\"center\">Convert date/time into a string relative to now.</h4>\n\n<p align=\"center\">\n  <a href=\"https://pypi.org/project/relative-to-now/\">\n    <img src=\"https://img.shields.io/badge/Python-3.7%20%7C%203.8%20%7C%203.9-blue\" alt=\"Python Version\">\n  </a>\n  <a href=\"https://codecov.io/gh/Riverside-Healthcare/RelativeToNow\">\n    <img src=\"https://codecov.io/gh/Riverside-Healthcare/RelativeToNow/branch/master/graph/badge.svg?token=PHYGI9FI22\" alt=\"Codecov Status\">\n  </a>\n  <a href=\"https://www.codacy.com/gh/Riverside-Healthcare/RelativeToNow/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Riverside-Healthcare/RelativeToNow&amp;utm_campaign=Badge_Grade\">\n    <img src=\"https://app.codacy.com/project/badge/Grade/2533c8838ffe4c6a82c889d6d98f2050\" alt=\"Codacy Status\">\n  </a>\n  <a href=\"https://pypi.org/project/relative-to-now/\">\n    <img src=\"https://badgen.net/pypi/v/relative-to-now\" alt=\"Pypi Download\">\n  </a>\n  <a href=\"https://pepy.tech/project/relative-to-now\">\n    <img src=\"https://static.pepy.tech/badge/relative-to-now\" alt=\"Downloads\">\n  </a>\n</p>\n\n\n## \ud83d\udcbe Install\n\n```sh\npython -m pip install relative-to-now\n\n# or\n\npoetry add relative-to-now\n```\n\n## \u2728 How to Use\n\nPossible input types:\n\n  * time.time()\n  * datetime.date.today()\n  * datetime.datetime.now()\n\nOptional inputs:\n\n  * ``no_errors`` (Defaults to ``False``, set to ``True`` to return value when there is an error instead of raising)\n\nOutput:\n    <int> <unit> <text>\n\nExamples:\n```python\nimport datetime\nfrom RelativeToNow import relative_to_now\n\nprint(relative_to_now(datetime.datetime.now() + datetime.timedelta(days=1)))\n>>> 1 day from now\n```\n\nPrecision for `datetime.date` is days.\n```python\nimport datetime\nfrom RelativeToNow import relative_to_now\n\nprint(relative_to_now(datetime.date.today() - datetime.timedelta(days=2)))\n>>> 2 days ago\n```\n\n```python\nimport time\nfrom RelativeToNow import relative_to_now\n\nprint(relative_to_now(time.time()))\n>>> just now\n```\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Print a datetime's distance from now",
    "version": "1.1.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "02216a2a467c2ef6c3c2e259a9e02cfffb695ac1163659b8ba0e69bb8a9c15ec",
                "md5": "40dc4df18c94a45345b47cb65e5c1250",
                "sha256": "88bd05d363bdd2007ec96edf0e3a8dc5cbbb248ec5d42e7322bc888252d7f6e1"
            },
            "downloads": -1,
            "filename": "relative_to_now-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "40dc4df18c94a45345b47cb65e5c1250",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.2,<4.0.0",
            "size": 15200,
            "upload_time": "2023-01-16T16:00:40",
            "upload_time_iso_8601": "2023-01-16T16:00:40.041738Z",
            "url": "https://files.pythonhosted.org/packages/02/21/6a2a467c2ef6c3c2e259a9e02cfffb695ac1163659b8ba0e69bb8a9c15ec/relative_to_now-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fdfb1790f745b5d01d52d4d1864e784ddebf9b25bfb8fd3aebc1261b83f4a793",
                "md5": "2aaabe88b59d03a7a7e780b881e17d82",
                "sha256": "c3c4a8963a3b823c3d8415a96f75226d617ef378c6d5e6c94cddb9eccdf8820a"
            },
            "downloads": -1,
            "filename": "relative_to_now-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2aaabe88b59d03a7a7e780b881e17d82",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.2,<4.0.0",
            "size": 15060,
            "upload_time": "2023-01-16T16:00:41",
            "upload_time_iso_8601": "2023-01-16T16:00:41.333735Z",
            "url": "https://files.pythonhosted.org/packages/fd/fb/1790f745b5d01d52d4d1864e784ddebf9b25bfb8fd3aebc1261b83f4a793/relative_to_now-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-16 16:00:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Riverside-Healthcare",
    "github_project": "RelativeToNow",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "relative-to-now"
}
        
Elapsed time: 0.02944s