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
Requirements • Installation • Examples • License
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
Project details
Release history Release notifications | RSS feed
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)