Skip to main content

A parser library built for parsing the english language into datetime objects.

Project description


datetimeparser

A python parser library made for parsing english language into datetime objects
made with ❤️ by aridevelopment.de

Report an issue · Request a new feature

About The Project

Datetimeparser is a python library capable of parsing the english language into datetime objects.
It was created due to the lack of such library and need for it. We knew that there was dateutil but we wanted a more powerful parsing library.
Datetimeparser can even parse complex grammar and sentence structure.

Latest Change

Examples

Below you can find some examples of how datetimeparser can be used.

from datetimeparser import parse

print(parse("next 3 years and 2 months"))
# 2025-04-06 11:43:28

print(parse("begin of advent of code 2022"))
# 2022-12-01 06:00:00

print(parse("in 1 Year 2 months 3 weeks 4 days 5 hours 6 minutes 7 seconds"))
# 2023-05-01 17:59:52

print(parse("10 days and 2 hours after 3 months before christmas 2020"))
# 2020-10-05 02:00:00

Installation

Use pip to install the library:

$ pip install python-datetimeparser

Contributing

If you want to contribute to datetimeparser, please use feature branches. If possible, name them after an already opened issue (e.g. feature/131).
We highly appreciate everyone who wants to help our project!

List of Constants

All Normal-Constants
christmas
  • xmas
silvester
  • new years eve
eastern
  • easter
nicholas
  • nicholas day
halloween
april fools day
  • april fool day
thanksgiving
saint patrick's day
  • saint patricks day
  • st. patrick's day
  • saint pt. day
  • st patrick's day
  • st patricks day
valentines day
  • valentine
  • valentine day
summer end
  • end of summer
  • end of the summer
winter end
  • end of winter
  • end of the winter
spring end
  • end of spring
  • end of the spring
fall end
  • end of fall
  • end of the fall
  • autumn end
  • end of autumn
  • end of the autumn
summer begin
  • summer
  • begin of summer
  • begin of the summer
winter begin
  • winter
  • begin of winter
  • begin of the winter
spring begin
  • spring
  • begin of spring
  • begin of the spring
fall begin
  • fall
  • begin of fall
  • begin of the fall
  • autumn begin
  • autumn
  • begin of autumn
  • begin of the autumn
morning
  • at morning
evening
  • at evening
lunchtime
  • lunch
aoc begin
  • aoc
  • begin of aoc
  • begin of the aoc
  • advent of code begin
  • advent of code
  • begin of advent of code
  • begin of the advent of code
aoc end
  • end of aoc
  • end of the aoc
  • advent of code end
  • end of advent of code
  • end of the advent of code
end of year
  • the end of year
  • the end of the year
  • end of the year
begin of year
  • the begin of year
  • the begin of the year
  • begin of the year
infinity
  • inf
today
tomorrow
yesterday
now
  • at the moment
  • current time
  • current time now

All Day-Constants
morning
afternoon
evening
night
morning night
daylight change
  • daylight saving
  • daylight saving time
midnight
midday
dawn
dusk
sunrise
sunset
lunch
  • lunchtime
dinner
  • dinnertime
breakfast

All Weekday-Constants
monday
tuesday
wednesday
thursday
friday
saturday
sunday

All Month-Constants
january
  • jan
february
  • feb
march
  • mar
april
  • apr
may
june
  • jun
july
  • jul
august
  • aug
september
  • sep
october
  • oct
november
  • nov
december
  • dec

All Datetime-Constants
seconds
  • second
  • sec
  • secs
minutes
  • minute
  • min
  • mins
hours
  • hour
days
  • day
weeks
  • week
months
  • month
years
  • year

All Number-Constants
thirty one
  • thirtyone
  • thirty-one
thirty
twenty nine
  • twentynine
  • twenty-nine
twenty eight
  • twentyeight
  • twenty-eight
twenty seven
  • twentyseven
  • twenty-seven
twenty six
  • twentysix
  • twenty-six
twenty five
  • twentyfive
  • twenty-five
twenty four
  • twentyfour
  • twenty-four
twenty three
  • twentythree
  • twenty-three
twenty two
  • twentytwo
  • twenty-two
twenty one
  • twentyone
  • twenty-one
twenty
nineteen
eighteen
seventeen
sixteen
fifteen
fourteen
thirteen
twelve
eleven
ten
nine
eight
seven
six
five
four
three
two
one

All NumberCount-Constants
thirty first
  • 31st
  • 31.
  • thirthyfirst
  • thirty-first
thirtieth
  • 30th
  • 30.
twenty ninth
  • 29th
  • 29.
  • twentyninth
  • twenty-ninth
twenty eighth
  • 28th
  • 28.
  • twentyeighth
  • twenty-eighth
twenty seventh
  • 27th
  • 27.
  • twentyseventh
  • twenty-seventh
twenty sixth
  • 26th
  • 26.
  • twentysixth
  • twenty-sixth
twenty fifth
  • 25th
  • 25.
  • twentyfifth
  • twenty-fifth
twenty fourth
  • 24th
  • 24.
  • twentyfourth
  • twenty-fourth
twenty third
  • 23rd
  • 23.
  • twentythird
  • twenty-third
twenty second
  • 22nd
  • 22.
  • twentysecond
  • twenty-second
twenty first
  • 21st
  • 21.
  • twentyfirst
  • twenty-first
twentieth
  • 20th
  • 20.
nineteenth
  • 19th
  • 19.
eighteenth
  • 18th
  • 18.
seventeenth
  • 17th
  • 17.
sixteenth
  • 16th
  • 16.
fifteenth
  • 15th
  • 15.
fourteenth
  • 14th
  • 14.
thirteenth
  • 13th
  • 13.
twelfth
  • 12th
  • 12.
eleventh
  • 11th
  • 11.
tenth
  • 10th
  • 10.
ninth
  • 9th
  • 9.
eighth
  • 8th
  • 8.
seventh
  • 7th
  • 7.
sixth
  • 6th
  • 6.
fifth
  • 5th
  • 5.
fourth
  • 4th
  • 4.
third
  • 3rd
  • 3.
second
  • 2nd
  • 2.
first
  • 1st
  • 1.

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

python-datetimeparser-0.4rc0.tar.gz (22.2 kB view hashes)

Uploaded Source

Built Distribution

python_datetimeparser-0.4rc0-py3-none-any.whl (21.4 kB view hashes)

Uploaded Python 3

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