Created
January 5, 2022 04:53
-
-
Save edgarrmondragon/ceab542c8dc5374e3a38616965f67dbf to your computer and use it in GitHub Desktop.
Parse human-readable relative times with Arrow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arrow | |
now = arrow.utcnow() | |
print(now) | |
# <Arrow [2022-01-05T04:51:29.467539+00:00]> | |
relative = now.dehumanize("3 months ago") | |
print(relative) | |
# <Arrow [2021-10-05T04:51:29.467539+00:00]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Arrow docs: https://arrow.readthedocs.io/en/latest/#dehumanize