timefhuman | Convert natural language date-like strings -- dates , date | Date Time Utils library
kandi X-RAY | timefhuman Summary
kandi X-RAY | timefhuman Summary
Convert human-readable, date-like strings written in natural language to Python objects. Describe specific datetimes or ranges of datetimes. Supports Python3+. To start, describe days of the week or times of day in the vernacular. Use any human-readable format with a time range, choices of times, or choices of time ranges. Parse lists of dates and times with more complex relationships. Use the vernacular to describe ranges or days.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Convert a human readable string into a human readable time
- Split a string into a list of tokens
- Convert tokens to tokens
- Convert day of week to day of week
- Share two DayToken objects
- Share property with other
- Combine two time ranges
timefhuman Key Features
timefhuman Examples and Code Snippets
>>> from timefhuman import timefhuman
>>> timefhuman('upcoming Monday noon')
datetime.datetime(2018, 8, 6, 12, 0)
>>> timefhuman('7/17 3-4 PM')
(datetime.datetime(2018, 7, 17, 15, 0), datetime.datetime(2018, 7, 17, 16, 0))
>>> import datetime
>>> now = datetime.datetime(2018, 8, 4, 0, 0)
>>> timefhuman('upcoming Monday noon', now=now)
datetime.datetime(2018, 8, 6, 12, 0)
>>> from timefhuman import timefhuman
>>> now = datet
>>> import dateparser
>>> dateparser.parse("7/7/18 3 p.m.") # yay!
datetime.datetime(2018, 7, 7, 15, 0)
>>> dateparser.parse("7/7/18 at 3") # :(
>>> dateparser.parse("7/17 12 PM") # yay!
datetime.datetime(2018,
Community Discussions
Trending Discussions on timefhuman
QUESTION
I have been trying to parse some very old data to structure and store them in a database. I have some random strings that contain dates.
YEAR:1999 DATE:09/1999
DATE:09/1996
DATE:1993
YEAR:2006 DATE:15/05/06
YEAR:2019 DATE:JANUARY 3, 2019
YEAR:2019 DATE:FEB. 14, 2019
YEAR:2019 DATE: 30/06/2019, JUNE 24, 2019
as you can see, there's a plethora of possibilities. I have tried with datetime, dateutil, dateparser and timefhuman to quickly get a date from this. None, of them had a desired output. Most success I have had is with dateparser.
...ANSWER
Answered 2019-Dec-04 at 16:04This is a very verbose parser for the format(s) you provided. Output is given as a list of [year, month, day], where each entry is only present if found in the date.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install timefhuman
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page