Skip to content

Instantly share code, notes, and snippets.

@edgarrmondragon
Created January 5, 2022 04:53
Show Gist options
  • Save edgarrmondragon/ceab542c8dc5374e3a38616965f67dbf to your computer and use it in GitHub Desktop.
Save edgarrmondragon/ceab542c8dc5374e3a38616965f67dbf to your computer and use it in GitHub Desktop.
Parse human-readable relative times with Arrow
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]>
@edgarrmondragon
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment