Skip to main content

Parse dates out of a textual string

Project description

# Date Range Parse

Crudely extends [dateparser](https://github.com/scrapinghub/dateparser) to extract out one or two dates from a string. Times are deliberately ignored, it only extracts the dates.

### Examples

from drparse import parse

Single Date with time range

dates = parse(“Thursday, July 28 at 8 PM - 11 PM”)

dates.start => datetime.datetime(2016, 7, 28, 0, 0)

Date range without time

dates = parse(“Thu, 6 - Sun, 16 Oct 2016”)

dates.start => datetime.datetime(2016, 10, 6, 0, 0) dates.end => datetime.datetime(2016, 10, 16, 0, 0)

Date range with time

dates = parse(“Sat May 28, 2016 to Sun May 29, 2016, 10PM till late”)

dates.start => datetime.datetime(2016, 5, 28, 0, 0) dates.end => datetime.datetime(2016, 5, 29, 0, 0)

### Further info

How to work with time/date ranges, changing default values, etc https://github.com/bear/parsedatetime/issues/162

Search text for dates https://github.com/scrapinghub/dateparser/issues/82

### Alternatives

You should probably just use this one instead!

https://github.com/robintw/daterangeparser

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

drparse-0.0.4.tar.gz (38.5 kB view details)

Uploaded Source

File details

Details for the file drparse-0.0.4.tar.gz.

File metadata

  • Download URL: drparse-0.0.4.tar.gz
  • Upload date:
  • Size: 38.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for drparse-0.0.4.tar.gz
Algorithm Hash digest
SHA256 63087496161757cded51a60ce68d2a285a2e9cfe81a6c1e3fac520c6639bf9c3
MD5 373dbf6251c958198cb14942ff56b1e8
BLAKE2b-256 9511ae4ac971af8ade8246277d45b619932f971fa316441d372240151cc6c42a

See more details on using hashes here.

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