BB-DateParser


NameBB-DateParser JSON
Version 0.2.43 PyPI version JSON
download
home_page
SummaryTry to parse date into a format for datetime
upload_time2023-10-08 23:26:26
maintainer
docs_urlNone
authorErik Beebe
requires_python>=3.10,<4.0
licenseMIT
keywords utility parser datetime
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```python

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "BB-DateParser",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "utility,parser,datetime",
    "author": "Erik Beebe",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/e2/90/4d487fc4fa7fe5c97d3c0099d047feda3751f3926d82c120d6e3f3dea7e0/bb_dateparser-0.2.43.tar.gz",
    "platform": null,
    "description": "# BB-DateParser\n\nAttempts 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.\n\n## Usage\n\n```python\n\nfrom dateparser import DateParser\n\nparser = DateParser()\nmy_date = \"October 1st, 1985 4:35pm\"\n\ndp = parser.parse_date( my_date )\n\n# To view format string\n\nprint( dp.formatting )\n'%B %dst, %Y %I:%M%p'\n\n# The DateParser class holds the data object from the last result. This is\n# cleared and recreated each time self.parse_date() is used. Below are the\n# data created and returned in a ParsedDate object from each date parsed\n\n# separated list of the date string\ndp.alldata = ['October', ' ', '01', 'st,', ' ', '1985', ' ', '04', ':', '35', 'PM']\n\n# list of actual date data in dictionary form { 'alldata index': str(data) }\ndp.data = { 0: 'October', 2: '1', 5: '1985', 7: '4', 9: '35', 10: 'pm' }\n\n# created datetime object from date string\ndp.dateObject = datetime.datetime(1985, 1, 1, 16, 35)\n\n# format code for datetime\ndp.formatting = '%B %mst, %Y %I:%M%p'\n\n# boolean - True only if successful in parsing the date\ndp.isValid = True\n\n# list of non date data pulled from date string\ndp.separators = [' ', 'st,', ' ', ' ', ':']\n\n# list of all possible results (is returned when 'list_all' = True)\ndp.format_list = ['%B %dst, %Y %I:%M%p']\n\n# DateParser is a subclass of DateData which is a subclass of the builtin\n# dict class. Therefore, all the parsing variables are also available through\n# the DateParser class.\n\n```\n\n### Changelog\n\n- 0.1.0\n    - Initial release\n\n- 0.2.0\n    - DateParser.parse_date() now returns a DateParser object\n    - Changed logging to an external module\n    - Added timestamp support\n    - Updated README\n\n- 0.2.1\n    - Now returns a separate parser object instead of self\n\n- 0.2.40\n    - Parses date based on more common date formats\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Try to parse date into a format for datetime",
    "version": "0.2.43",
    "project_urls": null,
    "split_keywords": [
        "utility",
        "parser",
        "datetime"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d61897386b81653e7316c321fd595171083852a1356acc75a63bd627caaae9a",
                "md5": "2d31f47578c310fc6cfd6aa9c8e4fa7a",
                "sha256": "0e2d75760092c62971a3786b86aa2b472eb33be827c4b7c4b37ea9525e727e85"
            },
            "downloads": -1,
            "filename": "bb_dateparser-0.2.43-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2d31f47578c310fc6cfd6aa9c8e4fa7a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 12241,
            "upload_time": "2023-10-08T23:26:25",
            "upload_time_iso_8601": "2023-10-08T23:26:25.266870Z",
            "url": "https://files.pythonhosted.org/packages/1d/61/897386b81653e7316c321fd595171083852a1356acc75a63bd627caaae9a/bb_dateparser-0.2.43-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e2904d487fc4fa7fe5c97d3c0099d047feda3751f3926d82c120d6e3f3dea7e0",
                "md5": "cd2220d1339042b802d9bc755573bb28",
                "sha256": "90d937f9ef8996a47bf1154a1978d6f126e5031d63b96da0a4f950a14b9db818"
            },
            "downloads": -1,
            "filename": "bb_dateparser-0.2.43.tar.gz",
            "has_sig": false,
            "md5_digest": "cd2220d1339042b802d9bc755573bb28",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 11779,
            "upload_time": "2023-10-08T23:26:26",
            "upload_time_iso_8601": "2023-10-08T23:26:26.783119Z",
            "url": "https://files.pythonhosted.org/packages/e2/90/4d487fc4fa7fe5c97d3c0099d047feda3751f3926d82c120d6e3f3dea7e0/bb_dateparser-0.2.43.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-08 23:26:26",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "bb-dateparser"
}
        
Elapsed time: 0.13128s