Skip to content

ammarjmhor10/past_date2word

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

past_date2word

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

PyPI - Python Version PyPI License Code style: black past_date2word-test

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 try it

License

GPLv3

About

Python library converts past date to text

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%