Skip to main content

past_date2word is library helps you to convert the past date to text

Project description

past_date2word

past_date2word is library helps you to convert the past date to text

Code style: black

RequirementsInstallationExamplesLicense


Requirements


Installation

Use PyPi to install past_date2word.

pip3 install past_date2word

Example

from past_date2word import past_date2word
from datetime import datetime, timedelta

# Less than one second of time
date = datetime.now() - timedelta(seconds=1)
print(past_date2word(date)) # "1 second ago"

# Less than 23 seconds of time
date = datetime.now() - timedelta(seconds=23)
print(past_date2word(date)) # "23 seconds ago"

# Less than 1 week and 1 day of time
date = datetime.now() - timedelta(weeks=1, days=1)
print(past_date2word(date)) #"1 week and 1 day ago"

# Less than 2 weeks and 4 days of time
date = datetime.now() - timedelta(weeks=2, days=4)
print(past_date2word(date)) #"2 weeks and 4 days ago"

# And More

License

GPLv3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

past_date2word-0.0.0.tar.gz (2.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page