BB-DateParser
Attempts to convert any written date into a datetime object. To make it more useful for my needs (and easier to write :P), it only works for years 1000 - 2099.
Usage
from dateparser import DateParser
parser = DateParser()
my_date = "October 1st, 1985 4:35pm"
dp = parser.parse_date( my_date )
# To view format string
print( dp.formatting )
'%B %dst, %Y %I:%M%p'
# The DateParser class holds the data object from the last result. This is
# cleared and recreated each time self.parse_date() is used. Below are the
# data created and returned in a ParsedDate object from each date parsed
# separated list of the date string
dp.alldata = ['October', ' ', '01', 'st,', ' ', '1985', ' ', '04', ':', '35', 'PM']
# list of actual date data in dictionary form { 'alldata index': str(data) }
dp.data = { 0: 'October', 2: '1', 5: '1985', 7: '4', 9: '35', 10: 'pm' }
# created datetime object from date string
dp.dateObject = datetime.datetime(1985, 1, 1, 16, 35)
# format code for datetime
dp.formatting = '%B %mst, %Y %I:%M%p'
# boolean - True only if successful in parsing the date
dp.isValid = True
# list of non date data pulled from date string
dp.separators = [' ', 'st,', ' ', ' ', ':']
# list of all possible results (is returned when 'list_all' = True)
dp.format_list = ['%B %dst, %Y %I:%M%p']
# DateParser is a subclass of DateData which is a subclass of the builtin
# dict class. Therefore, all the parsing variables are also available through
# the DateParser class.
Changelog
-
0.1.0
- Initial release
-
0.2.0
- DateParser.parse_date() now returns a DateParser object
- Changed logging to an external module
- Added timestamp support
- Updated README
-
0.2.1
- Now returns a separate parser object instead of self
-
0.2.40
- Parses date based on more common date formats
Metadata
Release files for BB-DateParser 0.2.43
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bb_dateparser-0.2.43.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bb_dateparser-0.2.43-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.0 kB
Release files / bb_dateparser-0.2.43.tar.gz
| Download URL | bb_dateparser-0.2.43.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90d937f9ef8996a47bf1154a1978d6f126e5031d63b96da0a4f950a14b9db818
|
|
BLAKE2b-256 checksum How to use checksums |
e2904d487fc4fa7fe5c97d3c0099d047feda3751f3926d82c120d6e3f3dea7e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.5 Linux/6.5.6-arch2-1
|
Release files / bb_dateparser-0.2.43-py3-none-any.whl
| Download URL | bb_dateparser-0.2.43-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e2d75760092c62971a3786b86aa2b472eb33be827c4b7c4b37ea9525e727e85
|
|
BLAKE2b-256 checksum How to use checksums |
1d61897386b81653e7316c321fd595171083852a1356acc75a63bd627caaae9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.5 Linux/6.5.6-arch2-1
|